home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Games Collection 1
/
software vault.zip
/
software vault
/
CDR10
/
TGE129C.ZIP
/
SOURCE
/
TGE.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-20
|
91KB
|
2,602 lines
/*****************************************************************************
* The Graphics Engine version 1.29ßC *
* *
* The Graphics Engine code and documentation are Copyright (c) 1993 *
* by Matthew Hildebrand. *
* *
* Unauthorised usage or modification of any or all of The Graphics *
* Engine is strictly prohibited. *
*****************************************************************************/
/* This copyright notice may not be removed and must remain intact */
static char copyright[] = "The Graphics Engine 1.29ßC -- Copyright (c) 1993 by Matthew Hildebrand";
/* Guess what... this file must be compiled with the large or huge model. */
#if !defined(__LARGE__) && !defined(__HUGE__) && !defined(M_I86LM)
#error This module must be compiled with the large or huge model.
#endif
#include <alloc.h>
#include <dos.h>
#include <math.h>
#include <mem.h>
#include <stdio.h>
#include <stdlib.h>
#include "tge.h"
/* #define macros needed only for TGE.C */
#define INADDR (TGEsys->inAddr)
#define OUTADDR (TGEsys->outAddr)
#define SCRADDR (TGEsys->scrAddr)
#define INSCREENWIDE (TGEsys->inScreenWide)
#define OUTSCREENWIDE (TGEsys->outScreenWide)
#define SCREEN 1
#define MEMORY 2
/******
******* Function prototypes
******/
static void far TGE_deInitGraphics(void);
static void far TGE_setPaletteReg(unsigned palReg, unsigned char red, unsigned char blue, unsigned char green);
static void far TGE_getPaletteReg(unsigned palReg, unsigned char *red, unsigned char *blue, unsigned char *green);
static void far TGE_setBlockPalette(unsigned firstReg, unsigned numRegs, void far *data);
static void far TGE_getBlockPalette(unsigned firstReg, unsigned numRegs, void far *data);
static unsigned far TGE_colourCloseTo(unsigned char red, unsigned char green, unsigned char blue);
static unsigned far TGE_colourCloseToX(unsigned char red, unsigned char green, unsigned char blue, unsigned colourExclude);
static unsigned long far TGE_imageSize(int ulx, int uly, int lrx, int lry);
static unsigned long far TGE_imageSizeDim(unsigned wide, unsigned deep);
static void huge TGE_getImage(int ulx, int uly, int lrx, int lry, void far *image);
static void far TGE_getLine(int lineNum, int xOff, int lineLen, void far *buf);
static unsigned far TGE_getPixel_scr(int x, int y);
static unsigned far TGE_getPixel_mem(int x, int y);
static void huge TGE_putImage(int x, int y, void far *image);
static void huge TGE_putImageInv(int x, int y, void far *image);
static void far TGE_putLine(int lineNum, int xOff, int lineLen, void far *buf);
static void far TGE_putLineInv(int lineNum, int xOff, int lineLen, void far *buf);
static void far TGE_putPixel_scr_copy(int x, int y, unsigned colour);
static void far TGE_putPixel_scr_and (int x, int y, unsigned colour);
static void far TGE_putPixel_scr_not (int x, int y, unsigned colour);
static void far TGE_putPixel_scr_or (int x, int y, unsigned colour);
static void far TGE_putPixel_scr_xor (int x, int y, unsigned colour);
static void far TGE_putPixel_mem_copy(int x, int y, unsigned colour);
static void far TGE_putPixel_mem_and (int x, int y, unsigned colour);
static void far TGE_putPixel_mem_not (int x, int y, unsigned colour);
static void far TGE_putPixel_mem_or (int x, int y, unsigned colour);
static void far TGE_putPixel_mem_xor (int x, int y, unsigned colour);
static void far TGE_line(int x1, int y1, int x2, int y2, unsigned colour);
static void far TGE_horizLine(int y, int x1, int x2, unsigned colour);
static void far TGE_vertLine(int x, int y1, int y2, unsigned colour);
static void far TGE_drawRect(int ulx, int uly, int lrx, int lry, unsigned colour);
static void far TGE_filledRect(int ulx, int uly, int lrx, int lry, unsigned colour);
static void far TGE_clearGraphics(unsigned colour);
static void far TGE_ellipse(int xc, int yc, int wide, int deep, unsigned colour);
static void far TGE_filledEllipse(int xc, int yc, int wide, int deep, unsigned colour);
static void far TGE_circle(int x, int y, int radius, unsigned colour);
static void far TGE_filledCircle(int x, int y, int radius, unsigned colour);
static void far TGE_fillRegion(int x, int y, unsigned colour);
static void* near forceOffset(void far *p);
static void near setupInfo(struct GraphDrv far *grDrv);
static void near set4Pixels(int x, int y, int xc, int yc, unsigned colour);
static void near fill4Pixels(int x, int y, int xc, int yc, unsigned colour);
static void near setInputFunctions(int memOrScreen);
static void near setOutputFunctions(int memOrScreen, int writeMode);
static unsigned char far* near inPixelAddr(int x, int y);
static unsigned char far* near outPixelAddr(int x, int y);
static int curOutputMode = TGE_COPY_PUT;
static int curOutputDest = SCREEN;
static void far *drvAddr = NULL;
struct GraphDrv far *TGEsys = NULL;
/*****
****** Routines to load a graphics driver from disk.
*****/
int TGE_loadGraphDriver(char *filename)
{
struct GraphDrv far *grDrv = NULL;
FILE *inFile;
long fileLen;
char signature[4];
/* Outsmart smart linkers; force copyright string to be in EXE file */
copyright[0] = 'T'; /* dummy write */
/* Open the input file */
if ((inFile=fopen(filename,"rb")) == NULL) /* open the file */
return (TGE_OPEN_ERR);
/* Get file size */
fseek(inFile, 0, SEEK_END); /* seek to end of file */
fileLen = ftell(inFile); /* get current position */
rewind(inFile); /* seek to start of file */
/* Parse the file header */
if (!fread(signature, 1, 4, inFile)) /* read signature string */
{
fclose(inFile);
return (TGE_FORMAT_ERR);
}
if (memcmp(signature, "TGE3", 4)) /* check signature string */
{
fclose(inFile);
return (TGE_FORMAT_ERR);
}
/* Allocate memory for the driver */
fileLen -= 4; /* remove signature size */
if (((void*)drvAddr=farmalloc(fileLen+15L)) == NULL) /* grab some RAM */
{
fclose(inFile);
return (TGE_ALLOC_ERR);
}
(void*)grDrv = forceOffset(drvAddr); /* force to XXXX:0004 */
/* Read in the body of the driver */
if (fread(grDrv, 1, (unsigned)fileLen, inFile) != (unsigned)fileLen)
{
fclose(inFile);
farfree(drvAddr);
return (TGE_FILE_ERR);
}
/* Everything is loaded properly; now set up for program use */
TGEsys = grDrv; /* set global variable */
setupInfo(grDrv); /* setup function pointers */
fclose(inFile); /* close input file */
return (TGE_SUCCESS); /* return success code */
}
/***
**** Force a pointer to the form XXXX:0004
***/
static void* near forceOffset(void far *p)
{
void huge *temp = (void huge*)p;
if (FP_OFF(temp) == 4)
return ((void far*)temp);
else if (FP_OFF(temp) > 4)
return (MK_FP(FP_SEG(temp)+1, 4));
else
return (MK_FP(FP_SEG(temp), 4));
}
/***
**** Set up function pointers once a driver has been loaded
***/
static void near setupInfo(struct GraphDrv far *grDrv)
{
register unsigned seg = FP_SEG(grDrv);
/* initGraphics must always be present */
(void*)grDrv->_initGraphics = MK_FP(seg, FP_OFF(grDrv->_initGraphics));
/* Set up non-I/O functions */
if (FP_OFF(grDrv->_deInitGraphics)) /* deInitGraphics */
(void*)grDrv->_deInitGraphics = MK_FP(seg, FP_OFF(grDrv->_deInitGraphics));
else
grDrv->_deInitGraphics = TGE_deInitGraphics;
if (FP_OFF(grDrv->_setPaletteReg)) /* setPaletteReg */
(void*)grDrv->_setPaletteReg = MK_FP(seg, FP_OFF(grDrv->_setPaletteReg));
else
grDrv->_setPaletteReg = TGE_setPaletteReg;
if (FP_OFF(grDrv->_getPaletteReg)) /* getPaletteReg */
(void*)grDrv->_getPaletteReg = MK_FP(seg, FP_OFF(grDrv->_getPaletteReg));
else
grDrv->_getPaletteReg = TGE_getPaletteReg;
if (FP_OFF(grDrv->_setBlockPalette)) /* setBlockPalette */
(void*)grDrv->_setBlockPalette = MK_FP(seg, FP_OFF(grDrv->_setBlockPalette));
else
grDrv->_setBlockPalette = TGE_setBlockPalette;
if (FP_OFF(grDrv->_getBlockPalette)) /* getBlockPalette */
(void*)grDrv->_getBlockPalette = MK_FP(seg, FP_OFF(grDrv->_getBlockPalette));
else
grDrv->_getBlockPalette = TGE_getBlockPalette;
if (FP_OFF(grDrv->_colourCloseTo)) /* colourCloseTo */
(void*)grDrv->_colourCloseTo = MK_FP(seg, FP_OFF(grDrv->_colourCloseTo));
else
grDrv->_colourCloseTo = TGE_colourCloseTo;
if (FP_OFF(grDrv->_colourCloseToX)) /* colourCloseToX */
(void*)grDrv->_colourCloseToX = MK_FP(seg, FP_OFF(grDrv->_colourCloseToX));
else
grDrv->_colourCloseToX = TGE_colourCloseToX;
if (FP_OFF(grDrv->_imageSize)) /* imageSize */
(void*)grDrv->_imageSize = MK_FP(seg, FP_OFF(grDrv->_imageSize));
else
grDrv->_imageSize = TGE_imageSize;
if (FP_OFF(grDrv->_imageSizeDim)) /* imageSizeDim */
(void*)grDrv->_imageSizeDim = MK_FP(seg, FP_OFF(grDrv->_imageSizeDim));
else
grDrv->_imageSizeDim = TGE_imageSizeDim;
/* Set up input functions */
if (FP_OFF(grDrv->_getImage_scr)) /* getImage_scr */
(void*)grDrv->_getImage_scr = MK_FP(seg, FP_OFF(grDrv->_getImage_scr));
else
grDrv->_getImage_scr = TGE_getImage;
if (FP_OFF(grDrv->_getImage_mem)) /* getImage_mem */
(void*)grDrv->_getImage_mem = MK_FP(seg, FP_OFF(grDrv->_getImage_mem));
else
grDrv->_getImage_mem = TGE_getImage;
if (FP_OFF(grDrv->_getLine_scr)) /* getLine_scr */
(void*)grDrv->_getLine_scr = MK_FP(seg, FP_OFF(grDrv->_getLine_scr));
else
grDrv->_getLine_scr = TGE_getLine;
if (FP_OFF(grDrv->_getLine_mem)) /* getLine_mem */
(void*)grDrv->_getLine_mem = MK_FP(seg, FP_OFF(grDrv->_getLine_mem));
else
grDrv->_getLine_mem = TGE_getLine;
if (FP_OFF(grDrv->_getPixel_scr)) /* getPixel_scr */
(void*)grDrv->_getPixel_scr = MK_FP(seg, FP_OFF(grDrv->_getPixel_scr));
else
grDrv->_getPixel_scr = TGE_getPixel_scr;
if (FP_OFF(grDrv->_getPixel_mem)) /* getPixel_mem */
(void*)grDrv->_getPixel_mem = MK_FP(seg, FP_OFF(grDrv->_getPixel_mem));
else
grDrv->_getPixel_mem = TGE_getPixel_mem;
/* Set up output functions */
if (FP_OFF(grDrv->_putImage_scr_copy)) /* putImage_scr_copy */
(void*)grDrv->_putImage_scr_copy = MK_FP(seg, FP_OFF(grDrv->_putImage_scr_copy));
else
grDrv->_putImage_scr_copy = TGE_putImage;
if (FP_OFF(grDrv->_putImage_scr_and)) /* putImage_scr_and */
(void*)grDrv->_putImage_scr_and = MK_FP(seg, FP_OFF(grDrv->_putImage_scr_and));
else
grDrv->_putImage_scr_and = TGE_putImage;
if (FP_OFF(grDrv->_putImage_scr_not)) /* putImage_scr_not */
(void*)grDrv->_putImage_scr_not = MK_FP(seg, FP_OFF(grDrv->_putImage_scr_not));
else
grDrv->_putImage_scr_not = TGE_putImage;
if (FP_OFF(grDrv->_putImage_scr_or)) /* putImage_scr_or */
(void*)grDrv->_putImage_scr_or = MK_FP(seg, FP_OFF(grDrv->_putImage_scr_or));
else
grDrv->_putImage_scr_or = TGE_putImage;
if (FP_OFF(grDrv->_putImage_scr_xor)) /* putImage_scr_xor */
(void*)grDrv->_putImage_scr_xor = MK_FP(seg, FP_OFF(grDrv->_putImage_scr_xor));
else
grDrv->_putImage_scr_xor = TGE_putImage;
if (FP_OFF(grDrv->_putImage_mem_copy)) /* putImage_mem_copy */
(void*)grDrv->_putImage_mem_copy = MK_FP(seg, FP_OFF(grDrv->_putImage_mem_copy));
else
grDrv->_putImage_mem_copy = TGE_putImage;
if (FP_OFF(grDrv->_putImage_mem_and)) /* putImage_mem_and */
(void*)grDrv->_putImage_mem_and = MK_FP(seg, FP_OFF(grDrv->_putImage_mem_and));
else
grDrv->_putImage_mem_and = TGE_putImage;
if (FP_OFF(grDrv->_putImage_mem_not)) /* putImage_mem_not */
(void*)grDrv->_putImage_mem_not = MK_FP(seg, FP_OFF(grDrv->_putImage_mem_not));
else
grDrv->_putImage_mem_not = TGE_putImage;
if (FP_OFF(grDrv->_putImage_mem_or)) /* putImage_mem_or */
(void*)grDrv->_putImage_mem_or = MK_FP(seg, FP_OFF(grDrv->_putImage_mem_or));
else
grDrv->_putImage_mem_or = TGE_putImage;
if (FP_OFF(grDrv->_putImage_mem_xor)) /* putImage_mem_xor */
(void*)grDrv->_putImage_mem_xor = MK_FP(seg, FP_OFF(grDrv->_putImage_mem_xor));
else
grDrv->_putImage_mem_xor = TGE_putImage;
if (FP_OFF(grDrv->_putImageInv_scr_copy)) /* putImageInv_scr_copy */
(void*)grDrv->_putImageInv_scr_copy = MK_FP(seg, FP_OFF(grDrv->_putImageInv_scr_copy));
else
grDrv->_putImageInv_scr_copy = TGE_putImageInv;
if (FP_OFF(grDrv->_putImageInv_scr_and)) /* putImageInv_scr_and */
(void*)grDrv->_putImageInv_scr_and = MK_FP(seg, FP_OFF(grDrv->_putImageInv_scr_and));
else
grDrv->_putImageInv_scr_and = TGE_putImageInv;
if (FP_OFF(grDrv->_putImageInv_scr_not)) /* putImageInv_scr_not */
(void*)grDrv->_putImageInv_scr_not = MK_FP(seg, FP_OFF(grDrv->_putImageInv_scr_not));
else
grDrv->_putImageInv_scr_not = TGE_putImageInv;
if (FP_OFF(grDrv->_putImageInv_scr_or)) /* putImageInv_scr_or */
(void*)grDrv->_putImageInv_scr_or = MK_FP(seg, FP_OFF(grDrv->_putImageInv_scr_or));
else
grDrv->_putImageInv_scr_or = TGE_putImageInv;
if (FP_OFF(grDrv->_putImageInv_scr_xor)) /* putImageInv_scr_xor */
(void*)grDrv->_putImageInv_scr_xor = MK_FP(seg, FP_OFF(grDrv->_putImageInv_scr_xor));
else
grDrv->_putImageInv_scr_xor = TGE_putImageInv;
if (FP_OFF(grDrv->_putImageInv_mem_copy)) /* putImageInv_mem_copy */
(void*)grDrv->_putImageInv_mem_copy = MK_FP(seg, FP_OFF(grDrv->_putImageInv_mem_copy));
else
grDrv->_putImageInv_mem_copy = TGE_putImageInv;
if (FP_OFF(grDrv->_putImageInv_mem_and)) /* putImageInv_mem_and */
(void*)grDrv->_putImageInv_mem_and = MK_FP(seg, FP_OFF(grDrv->_putImageInv_mem_and));
else
grDrv->_putImageInv_mem_and = TGE_putImageInv;
if (FP_OFF(grDrv->_putImageInv_mem_not)) /* putImageInv_mem_not */
(void*)grDrv->_putImageInv_mem_not = MK_FP(seg, FP_OFF(grDrv->_putImageInv_mem_not));
else
grDrv->_putImageInv_mem_not = TGE_putImageInv;
if (FP_OFF(grDrv->_putImageInv_mem_or)) /* putImageInv_mem_or */
(void*)grDrv->_putImageInv_mem_or = MK_FP(seg, FP_OFF(grDrv->_putImageInv_mem_or));
else
grDrv->_putImageInv_mem_or = TGE_putImageInv;
if (FP_OFF(grDrv->_putImageInv_mem_xor)) /* putImageInv_mem_xor */
(void*)grDrv->_putImageInv_mem_xor = MK_FP(seg, FP_OFF(grDrv->_putImageInv_mem_xor));
else
grDrv->_putImageInv_mem_xor = TGE_putImageInv;
if (FP_OFF(grDrv->_putLine_scr_copy)) /* putLine_scr_copy */
(void*)grDrv->_putLine_scr_copy = MK_FP(seg, FP_OFF(grDrv->_putLine_scr_copy));
else
grDrv->_putLine_scr_copy = TGE_putLine;
if (FP_OFF(grDrv->_putLine_scr_and)) /* putLine_scr_and */
(void*)grDrv->_putLine_scr_and = MK_FP(seg, FP_OFF(grDrv->_putLine_scr_and));
else
grDrv->_putLine_scr_and = TGE_putLine;
if (FP_OFF(grDrv->_putLine_scr_not)) /* putLine_scr_not */
(void*)grDrv->_putLine_scr_not = MK_FP(seg, FP_OFF(grDrv->_putLine_scr_not));
else
grDrv->_putLine_scr_not = TGE_putLine;
if (FP_OFF(grDrv->_putLine_scr_or)) /* putLine_scr_or */
(void*)grDrv->_putLine_scr_or = MK_FP(seg, FP_OFF(grDrv->_putLine_scr_or));
else
grDrv->_putLine_scr_or = TGE_putLine;
if (FP_OFF(grDrv->_putLine_scr_xor)) /* putLine_scr_xor */
(void*)grDrv->_putLine_scr_xor = MK_FP(seg, FP_OFF(grDrv->_putLine_scr_xor));
else
grDrv->_putLine_scr_xor = TGE_putLine;
if (FP_OFF(grDrv->_putLine_mem_copy)) /* putLine_mem_copy */
(void*)grDrv->_putLine_mem_copy = MK_FP(seg, FP_OFF(grDrv->_putLine_mem_copy));
else
grDrv->_putLine_mem_copy = TGE_putLine;
if (FP_OFF(grDrv->_putLine_mem_and)) /* putLine_mem_and */
(void*)grDrv->_putLine_mem_and = MK_FP(seg, FP_OFF(grDrv->_putLine_mem_and));
else
grDrv->_putLine_mem_and = TGE_putLine;
if (FP_OFF(grDrv->_putLine_mem_not)) /* putLine_mem_not */
(void*)grDrv->_putLine_mem_not = MK_FP(seg, FP_OFF(grDrv->_putLine_mem_not));
else
grDrv->_putLine_mem_not = TGE_putLine;
if (FP_OFF(grDrv->_putLine_mem_or)) /* putLine_mem_or */
(void*)grDrv->_putLine_mem_or = MK_FP(seg, FP_OFF(grDrv->_putLine_mem_or));
else
grDrv->_putLine_mem_or = TGE_putLine;
if (FP_OFF(grDrv->_putLine_mem_xor)) /* putLine_mem_xor */
(void*)grDrv->_putLine_mem_xor = MK_FP(seg, FP_OFF(grDrv->_putLine_mem_xor));
else
grDrv->_putLine_mem_xor = TGE_putLine;
if (FP_OFF(grDrv->_putLineInv_scr_copy)) /* putLineInv_scr_copy */
(void*)grDrv->_putLineInv_scr_copy = MK_FP(seg, FP_OFF(grDrv->_putLineInv_scr_copy));
else
grDrv->_putLineInv_scr_copy = TGE_putLineInv;
if (FP_OFF(grDrv->_putLineInv_scr_and)) /* putLineInv_scr_and */
(void*)grDrv->_putLineInv_scr_and = MK_FP(seg, FP_OFF(grDrv->_putLineInv_scr_and));
else
grDrv->_putLineInv_scr_and = TGE_putLineInv;
if (FP_OFF(grDrv->_putLineInv_scr_not)) /* putLineInv_scr_not */
(void*)grDrv->_putLineInv_scr_not = MK_FP(seg, FP_OFF(grDrv->_putLineInv_scr_not));
else
grDrv->_putLineInv_scr_not = TGE_putLineInv;
if (FP_OFF(grDrv->_putLineInv_scr_or)) /* putLineInv_scr_or */
(void*)grDrv->_putLineInv_scr_or = MK_FP(seg, FP_OFF(grDrv->_putLineInv_scr_or));
else
grDrv->_putLineInv_scr_or = TGE_putLineInv;
if (FP_OFF(grDrv->_putLineInv_scr_xor)) /* putLineInv_scr_xor */
(void*)grDrv->_putLineInv_scr_xor = MK_FP(seg, FP_OFF(grDrv->_putLineInv_scr_xor));
else
grDrv->_putLineInv_scr_xor = TGE_putLineInv;
if (FP_OFF(grDrv->_putLineInv_mem_copy)) /* putLineInv_mem_copy */
(void*)grDrv->_putLineInv_mem_copy = MK_FP(seg, FP_OFF(grDrv->_putLineInv_mem_copy));
else
grDrv->_putLineInv_mem_copy = TGE_putLineInv;
if (FP_OFF(grDrv->_putLineInv_mem_and)) /* putLineInv_mem_and */
(void*)grDrv->_putLineInv_mem_and = MK_FP(seg, FP_OFF(grDrv->_putLineInv_mem_and));
else
grDrv->_putLineInv_mem_and = TGE_putLineInv;
if (FP_OFF(grDrv->_putLineInv_mem_not)) /* putLineInv_mem_not */
(void*)grDrv->_putLineInv_mem_not = MK_FP(seg, FP_OFF(grDrv->_putLineInv_mem_not));
else
grDrv->_putLineInv_mem_not = TGE_putLineInv;
if (FP_OFF(grDrv->_putLineInv_mem_or)) /* putLineInv_mem_or */
(void*)grDrv->_putLineInv_mem_or = MK_FP(seg, FP_OFF(grDrv->_putLineInv_mem_or));
else
grDrv->_putLineInv_mem_or = TGE_putLineInv;
if (FP_OFF(grDrv->_putLineInv_mem_xor)) /* putLineInv_mem_xor */
(void*)grDrv->_putLineInv_mem_xor = MK_FP(seg, FP_OFF(grDrv->_putLineInv_mem_xor));
else
grDrv->_putLineInv_mem_xor = TGE_putLineInv;
if (FP_OFF(grDrv->_putPixel_scr_copy)) /* putPixel_scr_copy */
(void*)grDrv->_putPixel_scr_copy = MK_FP(seg, FP_OFF(grDrv->_putPixel_scr_copy));
else
grDrv->_putPixel_scr_copy = TGE_putPixel_scr_copy;
if (FP_OFF(grDrv->_putPixel_scr_and)) /* putPixel_scr_and */
(void*)grDrv->_putPixel_scr_and = MK_FP(seg, FP_OFF(grDrv->_putPixel_scr_and));
else
grDrv->_putPixel_scr_and = TGE_putPixel_scr_and;
if (FP_OFF(grDrv->_putPixel_scr_not)) /* putPixel_scr_not */
(void*)grDrv->_putPixel_scr_not = MK_FP(seg, FP_OFF(grDrv->_putPixel_scr_not));
else
grDrv->_putPixel_scr_not = TGE_putPixel_scr_not;
if (FP_OFF(grDrv->_putPixel_scr_or)) /* putPixel_scr_or */
(void*)grDrv->_putPixel_scr_or = MK_FP(seg, FP_OFF(grDrv->_putPixel_scr_or));
else
grDrv->_putPixel_scr_or = TGE_putPixel_scr_or;
if (FP_OFF(grDrv->_putPixel_scr_xor)) /* putPixel_scr_xor */
(void*)grDrv->_putPixel_scr_xor = MK_FP(seg, FP_OFF(grDrv->_putPixel_scr_xor));
else
grDrv->_putPixel_scr_xor = TGE_putPixel_scr_xor;
if (FP_OFF(grDrv->_putPixel_mem_copy)) /* putPixel_mem_copy */
(void*)grDrv->_putPixel_mem_copy = MK_FP(seg, FP_OFF(grDrv->_putPixel_mem_copy));
else
grDrv->_putPixel_mem_copy = TGE_putPixel_mem_copy;
if (FP_OFF(grDrv->_putPixel_mem_and)) /* putPixel_mem_and */
(void*)grDrv->_putPixel_mem_and = MK_FP(seg, FP_OFF(grDrv->_putPixel_mem_and));
else
grDrv->_putPixel_mem_and = TGE_putPixel_mem_and;
if (FP_OFF(grDrv->_putPixel_mem_not)) /* putPixel_mem_not */
(void*)grDrv->_putPixel_mem_not = MK_FP(seg, FP_OFF(grDrv->_putPixel_mem_not));
else
grDrv->_putPixel_mem_not = TGE_putPixel_mem_not;
if (FP_OFF(grDrv->_putPixel_mem_or)) /* putPixel_mem_or */
(void*)grDrv->_putPixel_mem_or = MK_FP(seg, FP_OFF(grDrv->_putPixel_mem_or));
else
grDrv->_putPixel_mem_or = TGE_putPixel_mem_or;
if (FP_OFF(grDrv->_putPixel_mem_xor)) /* putPixel_mem_xor */
(void*)grDrv->_putPixel_mem_xor = MK_FP(seg, FP_OFF(grDrv->_putPixel_mem_xor));
else
grDrv->_putPixel_mem_xor = TGE_putPixel_mem_xor;
if (FP_OFF(grDrv->_line_scr_copy)) /* line_scr_copy */
(void*)grDrv->_line_scr_copy = MK_FP(seg, FP_OFF(grDrv->_line_scr_copy));
else
grDrv->_line_scr_copy = TGE_line;
if (FP_OFF(grDrv->_line_scr_and)) /* line_scr_and */
(void*)grDrv->_line_scr_and = MK_FP(seg, FP_OFF(grDrv->_line_scr_and));
else
grDrv->_line_scr_and = TGE_line;
if (FP_OFF(grDrv->_line_scr_not)) /* line_scr_not */
(void*)grDrv->_line_scr_not = MK_FP(seg, FP_OFF(grDrv->_line_scr_not));
else
grDrv->_line_scr_not = TGE_line;
if (FP_OFF(grDrv->_line_scr_or)) /* line_scr_or */
(void*)grDrv->_line_scr_or = MK_FP(seg, FP_OFF(grDrv->_line_scr_or));
else
grDrv->_line_scr_or = TGE_line;
if (FP_OFF(grDrv->_line_scr_xor)) /* line_scr_xor */
(void*)grDrv->_line_scr_xor = MK_FP(seg, FP_OFF(grDrv->_line_scr_xor));
else
grDrv->_line_scr_xor = TGE_line;
if (FP_OFF(grDrv->_line_mem_copy)) /* line_mem_copy */
(void*)grDrv->_line_mem_copy = MK_FP(seg, FP_OFF(grDrv->_line_mem_copy));
else
grDrv->_line_mem_copy = TGE_line;
if (FP_OFF(grDrv->_line_mem_and)) /* line_mem_and */
(void*)grDrv->_line_mem_and = MK_FP(seg, FP_OFF(grDrv->_line_mem_and));
else
grDrv->_line_mem_and = TGE_line;
if (FP_OFF(grDrv->_line_mem_not)) /* line_mem_not */
(void*)grDrv->_line_mem_not = MK_FP(seg, FP_OFF(grDrv->_line_mem_not));
else
grDrv->_line_mem_not = TGE_line;
if (FP_OFF(grDrv->_line_mem_or)) /* line_mem_or */
(void*)grDrv->_line_mem_or = MK_FP(seg, FP_OFF(grDrv->_line_mem_or));
else
grDrv->_line_mem_or = TGE_line;
if (FP_OFF(grDrv->_line_mem_xor)) /* line_mem_xor */
(void*)grDrv->_line_mem_xor = MK_FP(seg, FP_OFF(grDrv->_line_mem_xor));
else
grDrv->_line_mem_xor = TGE_line;
if (FP_OFF(grDrv->_horizLine_scr_copy)) /* horizLine_scr_copy */
(void*)grDrv->_horizLine_scr_copy = MK_FP(seg, FP_OFF(grDrv->_horizLine_scr_copy));
else
grDrv->_horizLine_scr_copy = TGE_horizLine;
if (FP_OFF(grDrv->_horizLine_scr_and)) /* horizLine_scr_and */
(void*)grDrv->_horizLine_scr_and = MK_FP(seg, FP_OFF(grDrv->_horizLine_scr_and));
else
grDrv->_horizLine_scr_and = TGE_horizLine;
if (FP_OFF(grDrv->_horizLine_scr_not)) /* horizLine_scr_not */
(void*)grDrv->_horizLine_scr_not = MK_FP(seg, FP_OFF(grDrv->_horizLine_scr_not));
else
grDrv->_horizLine_scr_not = TGE_horizLine;
if (FP_OFF(grDrv->_horizLine_scr_or)) /* horizLine_scr_or */
(void*)grDrv->_horizLine_scr_or = MK_FP(seg, FP_OFF(grDrv->_horizLine_scr_or));
else
grDrv->_horizLine_scr_or = TGE_horizLine;
if (FP_OFF(grDrv->_horizLine_scr_xor)) /* horizLine_scr_xor */
(void*)grDrv->_horizLine_scr_xor = MK_FP(seg, FP_OFF(grDrv->_horizLine_scr_xor));
else
grDrv->_horizLine_scr_xor = TGE_horizLine;
if (FP_OFF(grDrv->_horizLine_mem_copy)) /* horizLine_mem_copy */
(void*)grDrv->_horizLine_mem_copy = MK_FP(seg, FP_OFF(grDrv->_horizLine_mem_copy));
else
grDrv->_horizLine_mem_copy = TGE_horizLine;
if (FP_OFF(grDrv->_horizLine_mem_and)) /* horizLine_mem_and */
(void*)grDrv->_horizLine_mem_and = MK_FP(seg, FP_OFF(grDrv->_horizLine_mem_and));
else
grDrv->_horizLine_mem_and = TGE_horizLine;
if (FP_OFF(grDrv->_horizLine_mem_not)) /* horizLine_mem_not */
(void*)grDrv->_horizLine_mem_not = MK_FP(seg, FP_OFF(grDrv->_horizLine_mem_not));
else
grDrv->_horizLine_mem_not = TGE_horizLine;
if (FP_OFF(grDrv->_horizLine_mem_or)) /* horizLine_mem_or */
(void*)grDrv->_horizLine_mem_or = MK_FP(seg, FP_OFF(grDrv->_horizLine_mem_or));
else
grDrv->_horizLine_mem_or = TGE_horizLine;
if (FP_OFF(grDrv->_horizLine_mem_xor)) /* horizLine_mem_xor */
(void*)grDrv->_horizLine_mem_xor = MK_FP(seg, FP_OFF(grDrv->_horizLine_mem_xor));
else
grDrv->_horizLine_mem_xor = TGE_horizLine;
if (FP_OFF(grDrv->_vertLine_scr_copy)) /* vertLine_scr_copy */
(void*)grDrv->_vertLine_scr_copy = MK_FP(seg, FP_OFF(grDrv->_vertLine_scr_copy));
else
grDrv->_vertLine_scr_copy = TGE_vertLine;
if (FP_OFF(grDrv->_vertLine_scr_and)) /* vertLine_scr_and */
(void*)grDrv->_vertLine_scr_and = MK_FP(seg, FP_OFF(grDrv->_vertLine_scr_and));
else
grDrv->_vertLine_scr_and = TGE_vertLine;
if (FP_OFF(grDrv->_vertLine_scr_not)) /* vertLine_scr_not */
(void*)grDrv->_vertLine_scr_not = MK_FP(seg, FP_OFF(grDrv->_vertLine_scr_not));
else
grDrv->_vertLine_scr_not = TGE_vertLine;
if (FP_OFF(grDrv->_vertLine_scr_or)) /* vertLine_scr_or */
(void*)grDrv->_vertLine_scr_or = MK_FP(seg, FP_OFF(grDrv->_vertLine_scr_or));
else
grDrv->_vertLine_scr_or = TGE_vertLine;
if (FP_OFF(grDrv->_vertLine_scr_xor)) /* vertLine_scr_xor */
(void*)grDrv->_vertLine_scr_xor = MK_FP(seg, FP_OFF(grDrv->_vertLine_scr_xor));
else
grDrv->_vertLine_scr_xor = TGE_vertLine;
if (FP_OFF(grDrv->_vertLine_mem_copy)) /* vertLine_mem_copy */
(void*)grDrv->_vertLine_mem_copy = MK_FP(seg, FP_OFF(grDrv->_vertLine_mem_copy));
else
grDrv->_vertLine_mem_copy = TGE_vertLine;
if (FP_OFF(grDrv->_vertLine_mem_and)) /* vertLine_mem_and */
(void*)grDrv->_vertLine_mem_and = MK_FP(seg, FP_OFF(grDrv->_vertLine_mem_and));
else
grDrv->_vertLine_mem_and = TGE_vertLine;
if (FP_OFF(grDrv->_vertLine_mem_not)) /* vertLine_mem_not */
(void*)grDrv->_vertLine_mem_not = MK_FP(seg, FP_OFF(grDrv->_vertLine_mem_not));
else
grDrv->_vertLine_mem_not = TGE_vertLine;
if (FP_OFF(grDrv->_vertLine_mem_or)) /* vertLine_mem_or */
(void*)grDrv->_vertLine_mem_or = MK_FP(seg, FP_OFF(grDrv->_vertLine_mem_or));
else
grDrv->_vertLine_mem_or = TGE_vertLine;
if (FP_OFF(grDrv->_vertLine_mem_xor)) /* vertLine_mem_xor */
(void*)grDrv->_vertLine_mem_xor = MK_FP(seg, FP_OFF(grDrv->_vertLine_mem_xor));
else
grDrv->_vertLine_mem_xor = TGE_vertLine;
if (FP_OFF(grDrv->_drawRect_scr_copy)) /* drawRect_scr_copy */
(void*)grDrv->_drawRect_scr_copy = MK_FP(seg, FP_OFF(grDrv->_drawRect_scr_copy));
else
grDrv->_drawRect_scr_copy = TGE_drawRect;
if (FP_OFF(grDrv->_drawRect_scr_and)) /* drawRect_scr_and */
(void*)grDrv->_drawRect_scr_and = MK_FP(seg, FP_OFF(grDrv->_drawRect_scr_and));
else
grDrv->_drawRect_scr_and = TGE_drawRect;
if (FP_OFF(grDrv->_drawRect_scr_not)) /* drawRect_scr_not */
(void*)grDrv->_drawRect_scr_not = MK_FP(seg, FP_OFF(grDrv->_drawRect_scr_not));
else
grDrv->_drawRect_scr_not = TGE_drawRect;
if (FP_OFF(grDrv->_drawRect_scr_or)) /* drawRect_scr_or */
(void*)grDrv->_drawRect_scr_or = MK_FP(seg, FP_OFF(grDrv->_drawRect_scr_or));
else
grDrv->_drawRect_scr_or = TGE_drawRect;
if (FP_OFF(grDrv->_drawRect_scr_xor)) /* drawRect_scr_xor */
(void*)grDrv->_drawRect_scr_xor = MK_FP(seg, FP_OFF(grDrv->_drawRect_scr_xor));
else
grDrv->_drawRect_scr_xor = TGE_drawRect;
if (FP_OFF(grDrv->_drawRect_mem_copy)) /* drawRect_mem_copy */
(void*)grDrv->_drawRect_mem_copy = MK_FP(seg, FP_OFF(grDrv->_drawRect_mem_copy));
else
grDrv->_drawRect_mem_copy = TGE_drawRect;
if (FP_OFF(grDrv->_drawRect_mem_and)) /* drawRect_mem_and */
(void*)grDrv->_drawRect_mem_and = MK_FP(seg, FP_OFF(grDrv->_drawRect_mem_and));
else
grDrv->_drawRect_mem_and = TGE_drawRect;
if (FP_OFF(grDrv->_drawRect_mem_not)) /* drawRect_mem_not */
(void*)grDrv->_drawRect_mem_not = MK_FP(seg, FP_OFF(grDrv->_drawRect_mem_not));
else
grDrv->_drawRect_mem_not = TGE_drawRect;
if (FP_OFF(grDrv->_drawRect_mem_or)) /* drawRect_mem_or */
(void*)grDrv->_drawRect_mem_or = MK_FP(seg, FP_OFF(grDrv->_drawRect_mem_or));
else
grDrv->_drawRect_mem_or = TGE_drawRect;
if (FP_OFF(grDrv->_drawRect_mem_xor)) /* drawRect_mem_xor */
(void*)grDrv->_drawRect_mem_xor = MK_FP(seg, FP_OFF(grDrv->_drawRect_mem_xor));
else
grDrv->_drawRect_mem_xor = TGE_drawRect;
if (FP_OFF(grDrv->_filledRect_scr_copy)) /* filledRect_scr_copy */
(void*)grDrv->_filledRect_scr_copy = MK_FP(seg, FP_OFF(grDrv->_filledRect_scr_copy));
else
grDrv->_filledRect_scr_copy = TGE_filledRect;
if (FP_OFF(grDrv->_filledRect_scr_and)) /* filledRect_scr_and */
(void*)grDrv->_filledRect_scr_and = MK_FP(seg, FP_OFF(grDrv->_filledRect_scr_and));
else
grDrv->_filledRect_scr_and = TGE_filledRect;
if (FP_OFF(grDrv->_filledRect_scr_not)) /* filledRect_scr_not */
(void*)grDrv->_filledRect_scr_not = MK_FP(seg, FP_OFF(grDrv->_filledRect_scr_not));
else
grDrv->_filledRect_scr_not = TGE_filledRect;
if (FP_OFF(grDrv->_filledRect_scr_or)) /* filledRect_scr_or */
(void*)grDrv->_filledRect_scr_or = MK_FP(seg, FP_OFF(grDrv->_filledRect_scr_or));
else
grDrv->_filledRect_scr_or = TGE_filledRect;
if (FP_OFF(grDrv->_filledRect_scr_xor)) /* filledRect_scr_xor */
(void*)grDrv->_filledRect_scr_xor = MK_FP(seg, FP_OFF(grDrv->_filledRect_scr_xor));
else
grDrv->_filledRect_scr_xor = TGE_filledRect;
if (FP_OFF(grDrv->_filledRect_mem_copy)) /* filledRect_mem_copy */
(void*)grDrv->_filledRect_mem_copy = MK_FP(seg, FP_OFF(grDrv->_filledRect_mem_copy));
else
grDrv->_filledRect_mem_copy = TGE_filledRect;
if (FP_OFF(grDrv->_filledRect_mem_and)) /* filledRect_mem_and */
(void*)grDrv->_filledRect_mem_and = MK_FP(seg, FP_OFF(grDrv->_filledRect_mem_and));
else
grDrv->_filledRect_mem_and = TGE_filledRect;
if (FP_OFF(grDrv->_filledRect_mem_not)) /* filledRect_mem_not */
(void*)grDrv->_filledRect_mem_not = MK_FP(seg, FP_OFF(grDrv->_filledRect_mem_not));
else
grDrv->_filledRect_mem_not = TGE_filledRect;
if (FP_OFF(grDrv->_filledRect_mem_or)) /* filledRect_mem_or */
(void*)grDrv->_filledRect_mem_or = MK_FP(seg, FP_OFF(grDrv->_filledRect_mem_or));
else
grDrv->_filledRect_mem_or = TGE_filledRect;
if (FP_OFF(grDrv->_filledRect_mem_xor)) /* filledRect_mem_xor */
(void*)grDrv->_filledRect_mem_xor = MK_FP(seg, FP_OFF(grDrv->_filledRect_mem_xor));
else
grDrv->_filledRect_mem_xor = TGE_filledRect;
if (FP_OFF(grDrv->_clearGraphics_scr_copy)) /* clearGraphics_scr_copy */
(void*)grDrv->_clearGraphics_scr_copy = MK_FP(seg, FP_OFF(grDrv->_clearGraphics_scr_copy));
else
grDrv->_clearGraphics_scr_copy = TGE_clearGraphics;
if (FP_OFF(grDrv->_clearGraphics_scr_and)) /* clearGraphics_scr_and */
(void*)grDrv->_clearGraphics_scr_and = MK_FP(seg, FP_OFF(grDrv->_clearGraphics_scr_and));
else
grDrv->_clearGraphics_scr_and = TGE_clearGraphics;
if (FP_OFF(grDrv->_clearGraphics_scr_not)) /* clearGraphics_scr_not */
(void*)grDrv->_clearGraphics_scr_not = MK_FP(seg, FP_OFF(grDrv->_clearGraphics_scr_not));
else
grDrv->_clearGraphics_scr_not = TGE_clearGraphics;
if (FP_OFF(grDrv->_clearGraphics_scr_or)) /* clearGraphics_scr_or */
(void*)grDrv->_clearGraphics_scr_or = MK_FP(seg, FP_OFF(grDrv->_clearGraphics_scr_or));
else
grDrv->_clearGraphics_scr_or = TGE_clearGraphics;
if (FP_OFF(grDrv->_clearGraphics_scr_xor)) /* clearGraphics_scr_xor */
(void*)grDrv->_clearGraphics_scr_xor = MK_FP(seg, FP_OFF(grDrv->_clearGraphics_scr_xor));
else
grDrv->_clearGraphics_scr_xor = TGE_clearGraphics;
if (FP_OFF(grDrv->_clearGraphics_mem_copy)) /* clearGraphics_mem_copy */
(void*)grDrv->_clearGraphics_mem_copy = MK_FP(seg, FP_OFF(grDrv->_clearGraphics_mem_copy));
else
grDrv->_clearGraphics_mem_copy = TGE_clearGraphics;
if (FP_OFF(grDrv->_clearGraphics_mem_and)) /* clearGraphics_mem_and */
(void*)grDrv->_clearGraphics_mem_and = MK_FP(seg, FP_OFF(grDrv->_clearGraphics_mem_and));
else
grDrv->_clearGraphics_mem_and = TGE_clearGraphics;
if (FP_OFF(grDrv->_clearGraphics_mem_not)) /* clearGraphics_mem_not */
(void*)grDrv->_clearGraphics_mem_not = MK_FP(seg, FP_OFF(grDrv->_clearGraphics_mem_not));
else
grDrv->_clearGraphics_mem_not = TGE_clearGraphics;
if (FP_OFF(grDrv->_clearGraphics_mem_or)) /* clearGraphics_mem_or */
(void*)grDrv->_clearGraphics_mem_or = MK_FP(seg, FP_OFF(grDrv->_clearGraphics_mem_or));
else
grDrv->_clearGraphics_mem_or = TGE_clearGraphics;
if (FP_OFF(grDrv->_clearGraphics_mem_xor)) /* clearGraphics_mem_xor */
(void*)grDrv->_clearGraphics_mem_xor = MK_FP(seg, FP_OFF(grDrv->_clearGraphics_mem_xor));
else
grDrv->_clearGraphics_mem_xor = TGE_clearGraphics;
if (FP_OFF(grDrv->_ellipse_scr_copy)) /* ellipse_scr_copy */
(void*)grDrv->_ellipse_scr_copy = MK_FP(seg, FP_OFF(grDrv->_ellipse_scr_copy));
else
grDrv->_ellipse_scr_copy = TGE_ellipse;
if (FP_OFF(grDrv->_ellipse_scr_and)) /* ellipse_scr_and */
(void*)grDrv->_ellipse_scr_and = MK_FP(seg, FP_OFF(grDrv->_ellipse_scr_and));
else
grDrv->_ellipse_scr_and = TGE_ellipse;
if (FP_OFF(grDrv->_ellipse_scr_not)) /* ellipse_scr_not */
(void*)grDrv->_ellipse_scr_not = MK_FP(seg, FP_OFF(grDrv->_ellipse_scr_not));
else
grDrv->_ellipse_scr_not = TGE_ellipse;
if (FP_OFF(grDrv->_ellipse_scr_or)) /* ellipse_scr_or */
(void*)grDrv->_ellipse_scr_or = MK_FP(seg, FP_OFF(grDrv->_ellipse_scr_or));
else
grDrv->_ellipse_scr_or = TGE_ellipse;
if (FP_OFF(grDrv->_ellipse_scr_xor)) /* ellipse_scr_xor */
(void*)grDrv->_ellipse_scr_xor = MK_FP(seg, FP_OFF(grDrv->_ellipse_scr_xor));
else
grDrv->_ellipse_scr_xor = TGE_ellipse;
if (FP_OFF(grDrv->_ellipse_mem_copy)) /* ellipse_mem_copy */
(void*)grDrv->_ellipse_mem_copy = MK_FP(seg, FP_OFF(grDrv->_ellipse_mem_copy));
else
grDrv->_ellipse_mem_copy = TGE_ellipse;
if (FP_OFF(grDrv->_ellipse_mem_and)) /* ellipse_mem_and */
(void*)grDrv->_ellipse_mem_and = MK_FP(seg, FP_OFF(grDrv->_ellipse_mem_and));
else
grDrv->_ellipse_mem_and = TGE_ellipse;
if (FP_OFF(grDrv->_ellipse_mem_not)) /* ellipse_mem_not */
(void*)grDrv->_ellipse_mem_not = MK_FP(seg, FP_OFF(grDrv->_ellipse_mem_not));
else
grDrv->_ellipse_mem_not = TGE_ellipse;
if (FP_OFF(grDrv->_ellipse_mem_or)) /* ellipse_mem_or */
(void*)grDrv->_ellipse_mem_or = MK_FP(seg, FP_OFF(grDrv->_ellipse_mem_or));
else
grDrv->_ellipse_mem_or = TGE_ellipse;
if (FP_OFF(grDrv->_ellipse_mem_xor)) /* ellipse_mem_xor */
(void*)grDrv->_ellipse_mem_xor = MK_FP(seg, FP_OFF(grDrv->_ellipse_mem_xor));
else
grDrv->_ellipse_mem_xor = TGE_ellipse;
if (FP_OFF(grDrv->_filledEllipse_scr_copy)) /* filledEllipse_scr_copy */
(void*)grDrv->_filledEllipse_scr_copy = MK_FP(seg, FP_OFF(grDrv->_filledEllipse_scr_copy));
else
grDrv->_filledEllipse_scr_copy = TGE_filledEllipse;
if (FP_OFF(grDrv->_filledEllipse_scr_and)) /* filledEllipse_scr_and */
(void*)grDrv->_filledEllipse_scr_and = MK_FP(seg, FP_OFF(grDrv->_filledEllipse_scr_and));
else
grDrv->_filledEllipse_scr_and = TGE_filledEllipse;
if (FP_OFF(grDrv->_filledEllipse_scr_not)) /* filledEllipse_scr_not */
(void*)grDrv->_filledEllipse_scr_not = MK_FP(seg, FP_OFF(grDrv->_filledEllipse_scr_not));
else
grDrv->_filledEllipse_scr_not = TGE_filledEllipse;
if (FP_OFF(grDrv->_filledEllipse_scr_or)) /* filledEllipse_scr_or */
(void*)grDrv->_filledEllipse_scr_or = MK_FP(seg, FP_OFF(grDrv->_filledEllipse_scr_or));
else
grDrv->_filledEllipse_scr_or = TGE_filledEllipse;
if (FP_OFF(grDrv->_filledEllipse_scr_xor)) /* filledEllipse_scr_xor */
(void*)grDrv->_filledEllipse_scr_xor = MK_FP(seg, FP_OFF(grDrv->_filledEllipse_scr_xor));
else
grDrv->_filledEllipse_scr_xor = TGE_filledEllipse;
if (FP_OFF(grDrv->_filledEllipse_mem_copy)) /* filledEllipse_mem_copy */
(void*)grDrv->_filledEllipse_mem_copy = MK_FP(seg, FP_OFF(grDrv->_filledEllipse_mem_copy));
else
grDrv->_filledEllipse_mem_copy = TGE_filledEllipse;
if (FP_OFF(grDrv->_filledEllipse_mem_and)) /* filledEllipse_mem_and */
(void*)grDrv->_filledEllipse_mem_and = MK_FP(seg, FP_OFF(grDrv->_filledEllipse_mem_and));
else
grDrv->_filledEllipse_mem_and = TGE_filledEllipse;
if (FP_OFF(grDrv->_filledEllipse_mem_not)) /* filledEllipse_mem_not */
(void*)grDrv->_filledEllipse_mem_not = MK_FP(seg, FP_OFF(grDrv->_filledEllipse_mem_not));
else
grDrv->_filledEllipse_mem_not = TGE_filledEllipse;
if (FP_OFF(grDrv->_filledEllipse_mem_or)) /* filledEllipse_mem_or */
(void*)grDrv->_filledEllipse_mem_or = MK_FP(seg, FP_OFF(grDrv->_filledEllipse_mem_or));
else
grDrv->_filledEllipse_mem_or = TGE_filledEllipse;
if (FP_OFF(grDrv->_filledEllipse_mem_xor)) /* filledEllipse_mem_xor */
(void*)grDrv->_filledEllipse_mem_xor = MK_FP(seg, FP_OFF(grDrv->_filledEllipse_mem_xor));
else
grDrv->_filledEllipse_mem_xor = TGE_filledEllipse;
if (FP_OFF(grDrv->_circle_scr_copy)) /* circle_scr_copy */
(void*)grDrv->_circle_scr_copy = MK_FP(seg, FP_OFF(grDrv->_circle_scr_copy));
else
grDrv->_circle_scr_copy = TGE_circle;
if (FP_OFF(grDrv->_circle_scr_and)) /* circle_scr_and */
(void*)grDrv->_circle_scr_and = MK_FP(seg, FP_OFF(grDrv->_circle_scr_and));
else
grDrv->_circle_scr_and = TGE_circle;
if (FP_OFF(grDrv->_circle_scr_not)) /* circle_scr_not */
(void*)grDrv->_circle_scr_not = MK_FP(seg, FP_OFF(grDrv->_circle_scr_not));
else
grDrv->_circle_scr_not = TGE_circle;
if (FP_OFF(grDrv->_circle_scr_or)) /* circle_scr_or */
(void*)grDrv->_circle_scr_or = MK_FP(seg, FP_OFF(grDrv->_circle_scr_or));
else
grDrv->_circle_scr_or = TGE_circle;
if (FP_OFF(grDrv->_circle_scr_xor)) /* circle_scr_xor */
(void*)grDrv->_circle_scr_xor = MK_FP(seg, FP_OFF(grDrv->_circle_scr_xor));
else
grDrv->_circle_scr_xor = TGE_circle;
if (FP_OFF(grDrv->_circle_mem_copy)) /* circle_mem_copy */
(void*)grDrv->_circle_mem_copy = MK_FP(seg, FP_OFF(grDrv->_circle_mem_copy));
else
grDrv->_circle_mem_copy = TGE_circle;
if (FP_OFF(grDrv->_circle_mem_and)) /* circle_mem_and */
(void*)grDrv->_circle_mem_and = MK_FP(seg, FP_OFF(grDrv->_circle_mem_and));
else
grDrv->_circle_mem_and = TGE_circle;
if (FP_OFF(grDrv->_circle_mem_not)) /* circle_mem_not */
(void*)grDrv->_circle_mem_not = MK_FP(seg, FP_OFF(grDrv->_circle_mem_not));
else
grDrv->_circle_mem_not = TGE_circle;
if (FP_OFF(grDrv->_circle_mem_or)) /* circle_mem_or */
(void*)grDrv->_circle_mem_or = MK_FP(seg, FP_OFF(grDrv->_circle_mem_or));
else
grDrv->_circle_mem_or = TGE_circle;
if (FP_OFF(grDrv->_circle_mem_xor)) /* circle_mem_xor */
(void*)grDrv->_circle_mem_xor = MK_FP(seg, FP_OFF(grDrv->_circle_mem_xor));
else
grDrv->_circle_mem_xor = TGE_circle;
if (FP_OFF(grDrv->_filledCircle_scr_copy)) /* filledCircle_scr_copy */
(void*)grDrv->_filledCircle_scr_copy = MK_FP(seg, FP_OFF(grDrv->_filledCircle_scr_copy));
else
grDrv->_filledCircle_scr_copy = TGE_filledCircle;
if (FP_OFF(grDrv->_filledCircle_scr_and)) /* filledCircle_scr_and */
(void*)grDrv->_filledCircle_scr_and = MK_FP(seg, FP_OFF(grDrv->_filledCircle_scr_and));
else
grDrv->_filledCircle_scr_and = TGE_filledCircle;
if (FP_OFF(grDrv->_filledCircle_scr_not)) /* filledCircle_scr_not */
(void*)grDrv->_filledCircle_scr_not = MK_FP(seg, FP_OFF(grDrv->_filledCircle_scr_not));
else
grDrv->_filledCircle_scr_not = TGE_filledCircle;
if (FP_OFF(grDrv->_filledCircle_scr_or)) /* filledCircle_scr_or */
(void*)grDrv->_filledCircle_scr_or = MK_FP(seg, FP_OFF(grDrv->_filledCircle_scr_or));
else
grDrv->_filledCircle_scr_or = TGE_filledCircle;
if (FP_OFF(grDrv->_filledCircle_scr_xor)) /* filledCircle_scr_xor */
(void*)grDrv->_filledCircle_scr_xor = MK_FP(seg, FP_OFF(grDrv->_filledCircle_scr_xor));
else
grDrv->_filledCircle_scr_xor = TGE_filledCircle;
if (FP_OFF(grDrv->_filledCircle_mem_copy)) /* filledCircle_mem_copy */
(void*)grDrv->_filledCircle_mem_copy = MK_FP(seg, FP_OFF(grDrv->_filledCircle_mem_copy));
else
grDrv->_filledCircle_mem_copy = TGE_filledCircle;
if (FP_OFF(grDrv->_filledCircle_mem_and)) /* filledCircle_mem_and */
(void*)grDrv->_filledCircle_mem_and = MK_FP(seg, FP_OFF(grDrv->_filledCircle_mem_and));
else
grDrv->_filledCircle_mem_and = TGE_filledCircle;
if (FP_OFF(grDrv->_filledCircle_mem_not)) /* filledCircle_mem_not */
(void*)grDrv->_filledCircle_mem_not = MK_FP(seg, FP_OFF(grDrv->_filledCircle_mem_not));
else
grDrv->_filledCircle_mem_not = TGE_filledCircle;
if (FP_OFF(grDrv->_filledCircle_mem_or)) /* filledCircle_mem_or */
(void*)grDrv->_filledCircle_mem_or = MK_FP(seg, FP_OFF(grDrv->_filledCircle_mem_or));
else
grDrv->_filledCircle_mem_or = TGE_filledCircle;
if (FP_OFF(grDrv->_filledCircle_mem_xor)) /* filledCircle_mem_xor */
(void*)grDrv->_filledCircle_mem_xor = MK_FP(seg, FP_OFF(grDrv->_filledCircle_mem_xor));
else
grDrv->_filledCircle_mem_xor = TGE_filledCircle;
if (FP_OFF(grDrv->_fillRegion_scr_copy)) /* fillRegion_scr_copy */
(void*)grDrv->_fillRegion_scr_copy = MK_FP(seg, FP_OFF(grDrv->_fillRegion_scr_copy));
else
grDrv->_fillRegion_scr_copy = TGE_fillRegion;
if (FP_OFF(grDrv->_fillRegion_scr_and)) /* fillRegion_scr_and */
(void*)grDrv->_fillRegion_scr_and = MK_FP(seg, FP_OFF(grDrv->_fillRegion_scr_and));
else
grDrv->_fillRegion_scr_and = TGE_fillRegion;
if (FP_OFF(grDrv->_fillRegion_scr_not)) /* fillRegion_scr_not */
(void*)grDrv->_fillRegion_scr_not = MK_FP(seg, FP_OFF(grDrv->_fillRegion_scr_not));
else
grDrv->_fillRegion_scr_not = TGE_fillRegion;
if (FP_OFF(grDrv->_fillRegion_scr_or)) /* fillRegion_scr_or */
(void*)grDrv->_fillRegion_scr_or = MK_FP(seg, FP_OFF(grDrv->_fillRegion_scr_or));
else
grDrv->_fillRegion_scr_or = TGE_fillRegion;
if (FP_OFF(grDrv->_fillRegion_scr_xor)) /* fillRegion_scr_xor */
(void*)grDrv->_fillRegion_scr_xor = MK_FP(seg, FP_OFF(grDrv->_fillRegion_scr_xor));
else
grDrv->_fillRegion_scr_xor = TGE_fillRegion;
if (FP_OFF(grDrv->_fillRegion_mem_copy)) /* fillRegion_mem_copy */
(void*)grDrv->_fillRegion_mem_copy = MK_FP(seg, FP_OFF(grDrv->_fillRegion_mem_copy));
else
grDrv->_fillRegion_mem_copy = TGE_fillRegion;
if (FP_OFF(grDrv->_fillRegion_mem_and)) /* fillRegion_mem_and */
(void*)grDrv->_fillRegion_mem_and = MK_FP(seg, FP_OFF(grDrv->_fillRegion_mem_and));
else
grDrv->_fillRegion_mem_and = TGE_fillRegion;
if (FP_OFF(grDrv->_fillRegion_mem_not)) /* fillRegion_mem_not */
(void*)grDrv->_fillRegion_mem_not = MK_FP(seg, FP_OFF(grDrv->_fillRegion_mem_not));
else
grDrv->_fillRegion_mem_not = TGE_fillRegion;
if (FP_OFF(grDrv->_fillRegion_mem_or)) /* fillRegion_mem_or */
(void*)grDrv->_fillRegion_mem_or = MK_FP(seg, FP_OFF(grDrv->_fillRegion_mem_or));
else
grDrv->_fillRegion_mem_or = TGE_fillRegion;
if (FP_OFF(grDrv->_fillRegion_mem_xor)) /* fillRegion_mem_xor */
(void*)grDrv->_fillRegion_mem_xor = MK_FP(seg, FP_OFF(grDrv->_fillRegion_mem_xor));
else
grDrv->_fillRegion_mem_xor = TGE_fillRegion;
if (FP_OFF(grDrv->_fillLine_scr_copy)) /* fillLine_scr_copy */
(void*)grDrv->_fillLine_scr_copy = MK_FP(seg, FP_OFF(grDrv->_fillLine_scr_copy));
else
grDrv->_fillLine_scr_copy = TGEsys->_horizLine_scr_copy;
if (FP_OFF(grDrv->_fillLine_scr_and)) /* fillLine_scr_and */
(void*)grDrv->_fillLine_scr_and = MK_FP(seg, FP_OFF(grDrv->_fillLine_scr_and));
else
grDrv->_fillLine_scr_and = TGEsys->_horizLine_scr_and;
if (FP_OFF(grDrv->_fillLine_scr_not)) /* fillLine_scr_not */
(void*)grDrv->_fillLine_scr_not = MK_FP(seg, FP_OFF(grDrv->_fillLine_scr_not));
else
grDrv->_fillLine_scr_not = TGEsys->_horizLine_scr_not;
if (FP_OFF(grDrv->_fillLine_scr_or)) /* fillLine_scr_or */
(void*)grDrv->_fillLine_scr_or = MK_FP(seg, FP_OFF(grDrv->_fillLine_scr_or));
else
grDrv->_fillLine_scr_or = TGEsys->_horizLine_scr_or;
if (FP_OFF(grDrv->_fillLine_scr_xor)) /* fillLine_scr_xor */
(void*)grDrv->_fillLine_scr_xor = MK_FP(seg, FP_OFF(grDrv->_fillLine_scr_xor));
else
grDrv->_fillLine_scr_xor = TGEsys->_horizLine_scr_xor;
if (FP_OFF(grDrv->_fillLine_mem_copy)) /* fillLine_mem_copy */
(void*)grDrv->_fillLine_mem_copy = MK_FP(seg, FP_OFF(grDrv->_fillLine_mem_copy));
else
grDrv->_fillLine_mem_copy = TGEsys->_horizLine_mem_copy;
if (FP_OFF(grDrv->_fillLine_mem_and)) /* fillLine_mem_and */
(void*)grDrv->_fillLine_mem_and = MK_FP(seg, FP_OFF(grDrv->_fillLine_mem_and));
else
grDrv->_fillLine_mem_and = TGEsys->_horizLine_mem_and;
if (FP_OFF(grDrv->_fillLine_mem_not)) /* fillLine_mem_not */
(void*)grDrv->_fillLine_mem_not = MK_FP(seg, FP_OFF(grDrv->_fillLine_mem_not));
else
grDrv->_fillLine_mem_not = TGEsys->_horizLine_mem_not;
if (FP_OFF(grDrv->_fillLine_mem_or)) /* fillLine_mem_or */
(void*)grDrv->_fillLine_mem_or = MK_FP(seg, FP_OFF(grDrv->_fillLine_mem_or));
else
grDrv->_fillLine_mem_or = TGEsys->_horizLine_mem_or;
if (FP_OFF(grDrv->_fillLine_mem_xor)) /* fillLine_mem_xor */
(void*)grDrv->_fillLine_mem_xor = MK_FP(seg, FP_OFF(grDrv->_fillLine_mem_xor));
else
grDrv->_fillLine_mem_xor = TGEsys->_horizLine_mem_xor;
/* Set up currently active functions */
setInputFunctions(SCREEN);
setOutputFunctions(SCREEN, TGE_COPY_PUT);
/* Set up the currently active viewports */
TGE_setViewports(0, 0, OUTMAXX, OUTMAXY);
}
/*****
****** Free graphics driver memory
*****/
void TGE_unloadGraphDriver(void)
{
if (drvAddr)
{
farfree(drvAddr);
drvAddr = NULL;
}
}
/******
******* High-level routines to be used if they aren't in a driver
******/
/***
**** deInitGraphics
***/
void TGE_deInitGraphics(void)
{
_AX = 0x0003;
geninterrupt(0x10);
}
/***
**** setPaletteReg
***/
void TGE_setPaletteReg(unsigned palReg, unsigned char red, unsigned char
blue, unsigned char green)
{
unsigned char r, g, b;
r = red >> 2; /* translate 8-bit to 6-bit */
if ((red&3) >= 2) /* round up if necessary */
r++;
if (r > 63) /* ensure in range 0..63 */
r = 63;
g = green >> 2;
if ((green&3) >= 2)
g++;
if (g > 63)
g = 63;
b = blue >> 2;
if ((blue&3) >= 2)
b++;
if (b > 63)
b = 63;
_AX = 0x1010; /* set up registers */
_BX = palReg;
_DH = r;
_CH = g;
_CL = b;
geninterrupt(0x10); /* call the video BIOS */
}
/***
**** getPaletteReg
***/
void TGE_getPaletteReg(unsigned palReg, unsigned char *red, unsigned char
*blue, unsigned char *green)
{
unsigned char r, g, b;
_AX = 0x1015; /* set up registers */
_BX = palReg;
geninterrupt(0x10); /* call the video BIOS */
r = _DH;
g = _CH;
b = _CL;
*red = r << 2; /* translate 6-bit to 8-bit */
*green = g << 2; /* and store new values */
*blue = b << 2;
}
#ifdef __BORLANDC__
#pragma option -h
#endif
/***
**** setBlockPalette
***/
void TGE_setBlockPalette(unsigned firstReg, unsigned lastReg, void far *data)
{
register unsigned count;
unsigned char r, g, b;
unsigned char huge *p;
p = (unsigned char*) data; /* initialize pointer */
for (count=firstReg; count<=lastReg; count++) /* main loop */
{
r = *p >> 2; /* translate 8-bit to 6-bit */
if ((*p&3) >= 2) /* round up if necessary */
r++;
if (r > 63) /* ensure in range 0..63 */
r = 63;
p++; /* update pointer */
g = *p >> 2;
if ((*p&3) >= 2)
g++;
if (g > 63)
g = 63;
p++;
b = *p >> 2;
if ((*p&3) >= 2)
b++;
if (b > 63)
b = 63;
p++;
_AX = 0x1010; /* set up registers */
_BX = count;
_DH = r;
_CH = g;
_CL = b;
geninterrupt(0x10); /* call the video BIOS */
}
}
/***
**** getBlockPalette
***/
void TGE_getBlockPalette(unsigned firstReg, unsigned lastReg, void far *data)
{
register unsigned count;
unsigned char r, g, b;
unsigned char huge *p;
p = (unsigned char*) data; /* initialize pointer */
for (count=firstReg; count<=lastReg; count++) /* main loop */
{
_AX = 0x1015; /* set up registers */
_BX = count;
geninterrupt(0x10); /* call the video BIOS */
r = _DH;
g = _CH;
b = _CL;
*p = r << 2; /* translate 6-bit to 8-bit */
p++; /* and store values */
*p = g << 2;
p++;
*p = b << 2;
p++;
}
}
/***
**** colourCloseTo
***/
static unsigned char palette[768];
unsigned TGE_colourCloseTo(unsigned char red, unsigned char green, unsigned
char blue)
{
register int count;
int redDif, greenDif, blueDif, curDif, bestDif=1000, curNet, bestNet=1000;
unsigned bestColour;
TGEsys->_getBlockPalette(0, 255, palette); /* get the palette */
for (count=255; count>=0; count--)
{
redDif = red - palette[3*count]; /* calculate greatest difference */
greenDif = green - palette[3*count+1];
blueDif = blue - palette[3*count+2];
curNet = redDif + greenDif + blueDif;
if (redDif < 0)
redDif = -redDif;
if (greenDif < 0)
greenDif = -greenDif;
if (blueDif < 0)
blueDif = -blueDif;
curDif = max(max(redDif,greenDif), blueDif);
if (!curDif) /* if same colour, return */
{
bestColour = count;
break;
}
if (curDif < bestDif) /* if better colour, set bestColour */
{
if (curNet <= bestNet)
{
bestDif = curDif;
bestColour = count;
}
}
}
return (bestColour);
}
/***
**** colourCloseToX
***/
unsigned TGE_colourCloseToX(unsigned char red, unsigned char green, unsigned
char blue, unsigned colourExclude)
{
register int count;
int redDif, greenDif, blueDif, curDif, bestDif=1000, curNet, bestNet=1000;
unsigned bestColour;
TGEsys->_getBlockPalette(0, 255, palette); /* get the palette */
for (count=255; count>=0; count--)
{
if (count != colourExclude)
{
redDif = red - palette[3*count]; /* calculate greatest difference */
greenDif = green - palette[3*count+1];
blueDif = blue - palette[3*count+2];
curNet = redDif + greenDif + blueDif;
if (redDif < 0)
redDif = -redDif;
if (greenDif < 0)
greenDif = -greenDif;
if (blueDif < 0)
blueDif = -blueDif;
curDif = max(max(redDif,greenDif), blueDif);
if (!curDif) /* if same colour, return */
{
bestColour = count;
break;
}
if (curDif < bestDif) /* if better colour, set bestColour */
{
if (curNet <= bestNet)
{
bestDif = curDif;
bestColour = count;
}
}
}
}
return (bestColour);
}
/***
**** imageSize
***/
unsigned long TGE_imageSize(int ulx, int uly, int lrx, int lry)
{
unsigned long size;
int temp;
if (lrx < ulx) /* swap coordinates if necessary */
{
temp = ulx;
lrx = ulx;
lrx = temp;
}
if (lry < uly)
{
temp = uly;
lry = uly;
lry = temp;
}
if (ulx < VIEWPORTULX) /* ensure coords are in bounds */
ulx = VIEWPORTULX;
else if (ulx > VIEWPORTLRX)
ulx = VIEWPORTLRX;
if (uly < VIEWPORTULY)
uly = VIEWPORTULY;
else if (uly > VIEWPORTLRY)
uly = VIEWPORTLRY;
if (lrx < VIEWPORTULX)
lrx = VIEWPORTULX;
else if (lrx > VIEWPORTLRX)
lrx = VIEWPORTLRX;
if (lry < VIEWPORTULY)
lry = VIEWPORTULY;
else if (lry > VIEWPORTLRY)
lry = VIEWPORTLRY;
size = (unsigned long)(lrx-ulx+1);
size *= (unsigned long)(lry-uly+1);
return (size+4); /* +4 for dimension information */
}
/***
**** imageSizeDim
***/
unsigned long TGE_imageSizeDim(unsigned wide, unsigned deep)
{
unsigned long size;
size = wide;
size *= deep;
return (size+4); /* +4 for dimension information */
}
#ifdef __BORLANDC__
#pragma option -h-
#endif
/***
**** putImage
***/
void huge TGE_putImage(int x, int y, void far *image)
{
register unsigned ycount;
int wide, deep;
register unsigned srcAdd = 0;
unsigned char huge *p = (unsigned char *)image;
wide = ((unsigned*)image)[0]; /* get image dimensions */
deep = ((unsigned*)image)[1];
p += 4; /* point to start of image data */
if (y < VIEWPORTULY) /* clip y coordinate */
{
if (y+deep >= VIEWPORTULY)
{
p += wide * abs(VIEWPORTULY-y); /* skip any offscreen rows */
deep -= abs(VIEWPORTULY-y); /* update image depth */
y = VIEWPORTULY; /* new y coordinate */
}
else
return;
}
else if (y > VIEWPORTLRY)
return;
if (y+deep > VIEWPORTLRY)
deep = VIEWPORTLRY-y + 1;
if (x < VIEWPORTULX) /* clip x coordinate */
{
if (x+wide >= VIEWPORTULX)
{
srcAdd += abs(VIEWPORTULX-x);
p += abs(VIEWPORTULX-x);
wide -= abs(VIEWPORTULX-x);
x = VIEWPORTULX;
}
else
return;
}
else if (x > VIEWPORTLRX)
return;
if (x+wide > VIEWPORTLRX)
{
srcAdd += wide-1 - (VIEWPORTLRX-x);
wide = VIEWPORTLRX-x + 1;
}
if (wide && deep) /* quit if image is 0x0 pixels */
{
srcAdd += wide;
for (ycount=0; ycount<deep; ycount++)
{
TGEsys->_putLine(y+ycount, x, wide, (void*)p);
p += srcAdd;
}
}
}
/***
**** putImageInv
***/
void huge TGE_putImageInv(int x, int y, void far *image)
{
register unsigned ycount;
int wide, deep;
register unsigned srcAdd = 0;
unsigned char huge *p = (unsigned char *)image;
wide = ((unsigned*)image)[0]; /* get image dimensions */
deep = ((unsigned*)image)[1];
p += 4; /* point to start of image data */
if (y < OUTVIEWPORTULY) /* clip y coordinate */
{
if (y+deep > OUTVIEWPORTULY)
{
p += wide * abs(OUTVIEWPORTULY-y);/* skip any offscreen rows */
deep -= abs(OUTVIEWPORTULY-y); /* update image depth */
y = OUTVIEWPORTULY; /* new y coordinate */
}
else
return;
}
else if (y > OUTVIEWPORTLRY)
return;
if (y+deep > OUTVIEWPORTLRY)
deep = OUTVIEWPORTLRY-y + 1;
if (x < OUTVIEWPORTULX) /* clip x coordinate */
{
if (x+wide > OUTVIEWPORTULX)
{
srcAdd += abs(OUTVIEWPORTULX-x);
p += abs(OUTVIEWPORTULX-x);
wide -= abs(OUTVIEWPORTULX-x);
x = OUTVIEWPORTULX;
}
else
return;
}
else if (x > OUTVIEWPORTLRX)
return;
if (x+wide > OUTVIEWPORTLRX)
{
srcAdd += wide-1 - (OUTVIEWPORTLRX-x);
wide = OUTVIEWPORTLRX-x + 1;
}
if (wide && deep) /* quit if offscreen */
{
srcAdd += wide;
for (ycount=0; ycount<deep; ycount++)
{
TGEsys->_putLineInv(y+ycount, x, wide, (void*)p);
p += srcAdd;
}
}
}
/***
**** getImage
***/
void huge TGE_getImage(int ulx, int uly, int lrx, int lry, void far *image)
{
register int ycount, wide, deep;
int temp;
unsigned char huge *p = (unsigned char*)image;
if (lrx < ulx) /* swap coordinates if necessary */
{
temp = ulx;
lrx = ulx;
lrx = temp;
}
if (lry < uly)
{
temp = uly;
lry = uly;
lry = temp;
}
if (ulx < INVIEWPORTULX) /* ensure coords are in bounds */
ulx = INVIEWPORTULX;
else if (ulx > INVIEWPORTLRX)
ulx = INVIEWPORTLRX;
if (uly < INVIEWPORTULY)
uly = INVIEWPORTULY;
else if (uly > INVIEWPORTLRY)
uly = INVIEWPORTLRY;
if (lrx < INVIEWPORTULX)
lrx = INVIEWPORTULX;
else if (lrx > INVIEWPORTLRX)
lrx = INVIEWPORTLRX;
if (lry < INVIEWPORTULY)
lry = INVIEWPORTULY;
else if (lry > INVIEWPORTLRY)
lry = INVIEWPORTLRY;
((unsigned *)image)[0] = wide = lrx-ulx+1;
((unsigned *)image)[1] = deep = lry-uly+1;
p += 4;
if (wide>0 && deep>0)
{
for (ycount=uly; ycount<=lry; ycount++)
{
TGEsys->_getLine(ycount, ulx, wide, (void*)p);
p += wide;
}
}
}
/***
**** putLine
***/
void TGE_putLine(int lineNum, int xOff, int lineLen, void far *buf)
{
register unsigned count, y;
for (count=0,y=lineNum; count<lineLen; count++) /* draw the line */
TGEsys->_putPixel(xOff+count, y, *((unsigned char huge*)buf+count));
}
/***
**** putLineInv
***/
void TGE_putLineInv(int lineNum, int xOff, int lineLen, void far *buf)
{
register unsigned count, y;
unsigned char huge *p = (unsigned char huge*) buf;
for (count=0,y=lineNum; count<lineLen; count++) /* draw the line */
{
if (*p)
TGEsys->_putPixel(xOff+count, y, *p);
p++;
}
}
/***
**** getLine
***/
void TGE_getLine(int lineNum, int xOff, int lineLen, void far *buf)
{
register unsigned count, y;
for (count=0,y=lineNum; count<lineLen; count++) /* draw the line */
*((unsigned char huge*)buf+count) = TGEsys->_getPixel(xOff+count, y);
}
/***
**** putPixel
***/
void TGE_putPixel_scr_copy(int x, int y, unsigned colour)
{
_AH = 0x0C;
_AL = (unsigned char)colour;
_BH = 0;
_CX = x;
_DX = y;
geninterrupt(0x10);
}
void TGE_putPixel_scr_and(int x, int y, unsigned colour)
{
_AH = 0x0D; /* get the pixel */
_BH = 0;
_CX = x;
_DX = y;
geninterrupt(0x10);
_AH = 0x0C; /* set the ANDed pixel */
_AL &= (unsigned char)colour;
_BH = 0;
_CX = x;
_DX = y;
geninterrupt(0x10);
}
void TGE_putPixel_scr_not(int x, int y, unsigned colour)
{
_AH = 0x0C; /* set the NOTed pixel */
_AL = ~(unsigned char)colour;
_BH = 0;
_CX = x;
_DX = y;
geninterrupt(0x10);
}
void TGE_putPixel_scr_or(int x, int y, unsigned colour)
{
_AH = 0x0D; /* get the pixel */
_BH = 0;
_CX = x;
_DX = y;
geninterrupt(0x10);
_AH = 0x0C; /* set the ORed pixel */
_AL |= (unsigned char)colour;
_BH = 0;
_CX = x;
_DX = y;
geninterrupt(0x10);
}
void TGE_putPixel_scr_xor(int x, int y, unsigned colour)
{
_AH = 0x0D; /* get the pixel */
_BH = 0;
_CX = x;
_DX = y;
geninterrupt(0x10);
_AH = 0x0C; /* set the XORed pixel */
_AL ^= (unsigned char)colour;
_BH = 0;
_CX = x;
_DX = y;
geninterrupt(0x10);
}
void TGE_putPixel_mem_copy(int x, int y, unsigned colour)
{
*(outPixelAddr(x,y)) = (unsigned char)colour; /* write the pixel */
}
void TGE_putPixel_mem_and(int x, int y, unsigned colour)
{
*(outPixelAddr(x,y)) &= (unsigned char)colour; /* write the pixel */
}
void TGE_putPixel_mem_not(int x, int y, unsigned colour)
{
*(outPixelAddr(x,y)) = ~(unsigned char)colour; /* write the pixel */
}
void TGE_putPixel_mem_or(int x, int y, unsigned colour)
{
*(outPixelAddr(x,y)) |= (unsigned char)colour; /* write the pixel */
}
void TGE_putPixel_mem_xor(int x, int y, unsigned colour)
{
*(outPixelAddr(x,y)) ^= (unsigned char)colour; /* write the pixel */
}
/***
**** getPixel
***/
unsigned TGE_getPixel_scr(int x, int y)
{
_AH = 0x0D;
_BH = 0;
_CX = x;
_DX = y;
geninterrupt(0x10);
_AH = 0;
return (_AX);
}
unsigned TGE_getPixel_mem(int x, int y)
{
return ((unsigned) *(inPixelAddr(x,y)));
}
/***
**** line
***/
void TGE_line(int x1, int y1, int x2, int y2, unsigned colour)
{
register int t, distance;
int xerr=0, yerr=0, deltax, deltay;
int incx, incy;
deltax = x2 - x1; /* compute both distances */
deltay = y2 - y1;
if (deltax > 0) /* compute increments */
incx = 1;
else if (deltax == 0)
incx = 0;
else
incx = -1;
if (deltay > 0)
incy = 1;
else if (deltay == 0)
incy = 0;
else
incy = -1;
deltax = abs(deltax); /* determine greater distance */
deltay = abs(deltay);
if (deltax > deltay)
distance = deltax;
else
distance = deltay;
for (t=0; t<=distance+1; t++) /* draw the line */
{
TGEsys->_putPixel(x1, y1, colour);
xerr += deltax;
yerr += deltay;
if (xerr > distance)
{
xerr -= distance;
x1 += incx;
}
if (yerr > distance)
{
yerr -= distance;
y1 += incy;
}
}
}
/***
**** horizLine
***/
void TGE_horizLine(int y, int x1, int x2, unsigned colour)
{
register unsigned count, max;
for (count=x1,max=x2; count<=max; count++) /* draw the line */
TGEsys->_putPixel(count, y, colour);
}
/***
**** vertLine
***/
void TGE_vertLine(int x, int y1, int y2, unsigned colour)
{
register unsigned count, max;
for (count=y1,max=y2; count<=max; count++) /* draw the line */
TGEsys->_putPixel(x, count, colour);
}
/***
**** drawRect
***/
void TGE_drawRect(int ulx, int uly, int lrx, int lry, unsigned colour)
{
register int ulxTemp, lrxTemp, temp;
if (ulx > lrx) /* swap coords if necessary */
{
temp = ulx;
ulx = lrx;
lrx = temp;
}
if (uly > lry)
{
temp = uly;
uly = lry;
lry = temp;
}
if (ulx<=VIEWPORTLRX && uly<=VIEWPORTLRY && lrx>=VIEWPORTULX &&
lry>=VIEWPORTULY)
{
ulxTemp = ulx+1>=VIEWPORTULX ? ulx+1 : VIEWPORTULX;
lrxTemp = lrx-1<=VIEWPORTLRX ? lrx-1 : VIEWPORTLRX;
/* Draw horizontal lines if necessary */
if (lrxTemp-ulxTemp > 1)
{
if (uly >= VIEWPORTULY)
TGEsys->_horizLine(uly, ulxTemp, lrxTemp, colour); /* top */
if (lry <= VIEWPORTLRY)
TGEsys->_horizLine(lry, ulxTemp, lrxTemp, colour); /* bottom */
}
/* Clip y coordinates */
if (uly < VIEWPORTULY)
uly = VIEWPORTULY;
if (lry > VIEWPORTLRY)
lry = VIEWPORTLRY;
/* Draw vertical lines if necessary */
if (ulx >= VIEWPORTULX)
TGEsys->_vertLine(ulx, uly, lry, colour); /* left */
if (lrx <= VIEWPORTLRX)
TGEsys->_vertLine(lrx, uly, lry, colour); /* right */
}
}
/***
**** filledRect
***/
void TGE_filledRect(int ulx, int uly, int lrx, int lry, unsigned
colour)
{
register unsigned count, max;
int temp;
if (ulx > lrx) /* swap coords if necessary */
{
temp = ulx;
ulx = lrx;
lrx = temp;
}
if (uly > lry)
{
temp = uly;
uly = lry;
lry = temp;
}
max = lry;
for (count=uly; count<=max; count++)
TGEsys->_fillLine(count, ulx, lrx, colour);
}
/***
**** clearGraphics
***/
void TGE_clearGraphics(unsigned colour)
{
TGEsys->_filledRect(0, 0, MAXX, MAXY, colour);
}
/***
**** ellipse
***/
void TGE_ellipse(int xc, int yc, int wide, int deep, unsigned colour)
{
int x, y;
long a, b;
long Asquared, TwoAsquared;
long Bsquared, TwoBsquared;
long d, dx, dy;
wide /= 2;
deep /= 2;
x = 0; /* initialize variables */
y = deep;
a = wide;
b = deep;
Asquared = a * a;
TwoAsquared = 2 * Asquared;
Bsquared = b * b;
TwoBsquared = 2 * Bsquared;
d = Bsquared - Asquared*b + Asquared/4L;
dx = 0;
dy = TwoAsquared * b;
while (dx < dy)
{
set4Pixels(x, y, xc, yc, colour);
if (d > 0L)
{
y--;
dy -= TwoAsquared;
d -= dy;
}
x++;
dx += TwoBsquared;
d += Bsquared + dx;
}
d += (3L*(Asquared-Bsquared)/2L - (dx+dy)) / 2L;
while (y >= 0)
{
set4Pixels(x, y, xc, yc, colour);
if (d < 0L)
{
x++;
dx += TwoBsquared;
d += dx;
}
y--;
dy -= TwoAsquared;
d += Asquared - dy;
}
}
void near set4Pixels(int x, int y, int xc, int yc, unsigned colour)
{
register int xCoord, yCoord;
xCoord = xc + x;
yCoord = yc + y;
if (TGE_clipPoint(xCoord, yCoord))
TGEsys->_putPixel(xCoord, yCoord, colour);
xCoord = xc - x;
if (TGE_clipPoint(xCoord, yCoord))
TGEsys->_putPixel(xCoord, yCoord, colour);
xCoord = xc + x;
yCoord = yc - y;
if (TGE_clipPoint(xCoord, yCoord))
TGEsys->_putPixel(xCoord, yCoord, colour);
xCoord = xc - x;
if (TGE_clipPoint(xCoord, yCoord))
TGEsys->_putPixel(xCoord, yCoord, colour);
}
/***
**** filledEllipse
***/
void TGE_filledEllipse(int xc, int yc, int wide, int deep, unsigned colour)
{
int x, y;
long a, b;
long Asquared, TwoAsquared;
long Bsquared, TwoBsquared;
long d, dx, dy;
wide /= 2;
deep /= 2;
x = 0; /* initialize variables */
y = deep;
a = wide;
b = deep;
Asquared = a * a;
TwoAsquared = 2 * Asquared;
Bsquared = b * b;
TwoBsquared = 2 * Bsquared;
d = Bsquared - Asquared*b + Asquared/4L;
dx = 0;
dy = TwoAsquared * b;
while (dx < dy)
{
fill4Pixels(x, y, xc, yc, colour);
if (d > 0L)
{
y--;
dy -= TwoAsquared;
d -= dy;
}
x++;
dx += TwoBsquared;
d += Bsquared + dx;
}
d += (3L*(Asquared-Bsquared)/2L - (dx+dy)) / 2L;
while (y >= 0)
{
fill4Pixels(x, y, xc, yc, colour);
if (d < 0L)
{
x++;
dx += TwoBsquared;
d += dx;
}
y--;
dy -= TwoAsquared;
d += Asquared - dy;
}
}
void near fill4Pixels(int x, int y, int xc, int yc, unsigned colour)
{
register int xCoord1, xCoord2, yCoord;
int temp;
xCoord1 = xc - x;
xCoord2 = xc + x;
if (xCoord1>VIEWPORTLRX || xCoord2<VIEWPORTULX)
return;
if (xCoord1 > xCoord2) /* ensure xCoord1 <= xCoord2 */
{
temp = xCoord1;
xCoord1 = xCoord2;
xCoord2 = temp;
}
yCoord = yc - y;
if (yCoord>=VIEWPORTULY && yCoord<=VIEWPORTLRY)
{
if (xCoord1 < VIEWPORTULX) /* clip xCoord1 horizontally */
xCoord1 = VIEWPORTULX;
else if (xCoord1 > VIEWPORTLRX)
xCoord1 = VIEWPORTLRX;
if (xCoord2 < VIEWPORTULX) /* clip xCoord2 horizontally */
xCoord2 = VIEWPORTULX;
else if (xCoord2 > VIEWPORTLRX)
xCoord2 = VIEWPORTLRX;
TGEsys->_fillLine(yCoord, xCoord1, xCoord2, colour);
}
yCoord = yc + y;
if (yCoord>=VIEWPORTULY && yCoord<=VIEWPORTLRY)
{
if (xCoord1 < VIEWPORTULX) /* clip xCoord1 horizontally */
xCoord1 = VIEWPORTULX;
else if (xCoord1 > VIEWPORTLRX)
xCoord1 = VIEWPORTLRX;
if (xCoord2 < VIEWPORTULX) /* clip xCoord2 horizontally */
xCoord2 = VIEWPORTULX;
else if (xCoord2 > VIEWPORTLRX)
xCoord2 = VIEWPORTLRX;
TGEsys->_fillLine(yCoord, xCoord1, xCoord2, colour);
}
}
/***
**** circle
***/
void TGE_circle(int x, int y, int radius, unsigned colour)
{
TGEsys->_ellipse(x, y, 2*radius, (2*radius*(4*YRATIO))/(3*XRATIO), colour);
}
/***
**** filledCircle
***/
void TGE_filledCircle(int x, int y, int radius, unsigned colour)
{
TGEsys->_filledEllipse(x, y, 2*radius, (2*radius*(4*YRATIO))/(3*XRATIO), colour);
}
/***
**** fillRegion
***/
static struct params {
int x, y;
};
static unsigned regionColour, fillColour;
static int okToPush;
static struct params huge *stack;
static unsigned long stackSize, stackPtr;
void TGE_fillRegion(int seedX, int seedY, unsigned colour)
{
struct params holder;
register int x, v;
int xl, xr, y;
if (!TGE_clipPoint(seedX, seedY)) /* abort if seed point */
return; /* is outside viewport */
regionColour = TGEsys->_getPixel(seedX, seedY); /* initialize variables */
if (regionColour == colour)
return;
fillColour = colour;
stackSize = farcoreleft(); /* grab a very large */
(void*)stack = farmalloc(stackSize); /* stack buffer */
stackSize /= sizeof(struct params);
stackPtr = 0;
okToPush = 1;
holder.x = seedX; /* push initial parameters */
holder.y = seedY;
stack[stackPtr] = holder;
stackPtr++;
while (stackPtr && stackPtr<=stackSize) /* main loop */
{
stackPtr--;
holder = stack[stackPtr];
xl = xr = holder.x;
y = holder.y;
x = xl; /* scan left */
if (x > VIEWPORTULX)
{
do
{
x--;
v = TGEsys->_getPixel(x, y);
}
while ((v==regionColour) && (v!=fillColour) && (x>=VIEWPORTULX));
x++;
xl = x;
}
x = xr; /* scan right */
if (x <= VIEWPORTLRX)
{
do
{
x++;
v = TGEsys->_getPixel(x, y);
}
while ((v==regionColour) && (v!=fillColour) && (x<=VIEWPORTLRX));
x--;
xr = x;
}
TGEsys->_fillLine(y, xl, xr, fillColour); /* fill the line */
/* scan upwards */
if (y > VIEWPORTULY)
{
for (x=xl; x<=xr; x++)
{
v = TGEsys->_getPixel(x, y-1);
if (v==regionColour && okToPush)
{
holder.x = x;
holder.y = y-1;
stack[stackPtr] = holder;
stackPtr++;
if (stackPtr != stackSize)
{
do
{
x++;
v = TGEsys->_getPixel(x, y-1);
}
while (v==regionColour && x<=xr);
x--;
}
else
okToPush = 0;
}
}
}
/* scan downwards */
if (y < VIEWPORTLRY)
{
for (x=xl; x<=xr; x++)
{
v = TGEsys->_getPixel(x, y+1);
if (v==regionColour && okToPush)
{
holder.x = x;
holder.y = y+1;
stack[stackPtr] = holder;
stackPtr++;
if (stackPtr != stackSize)
{
do
{
x++;
v = TGEsys->_getPixel(x, y+1);
}
while (v==regionColour && x<=xr);
x--;
}
else
okToPush = 0;
}
}
}
};
farfree((void far*)stack); /* release stack memory */
}
/*****
****** Viewport routines
*****/
void TGE_setViewports(int ulx, int uly, int lrx, int lry)
{
disable();
OUTVIEWPORTULX = ulx; /* set values */
INVIEWPORTULX = ulx;
OUTVIEWPORTULY = uly;
INVIEWPORTULY = uly;
OUTVIEWPORTLRX = lrx;
INVIEWPORTLRX = lrx;
OUTVIEWPORTLRY = lry;
INVIEWPORTLRY = lry;
enable();
}
void TGE_setOutputViewport(int ulx, int uly, int lrx, int lry)
{
disable();
OUTVIEWPORTULX = ulx; /* set values */
OUTVIEWPORTULY = uly;
OUTVIEWPORTLRX = lrx;
OUTVIEWPORTLRY = lry;
enable();
}
void TGE_setInputViewport(int ulx, int uly, int lrx, int lry)
{
disable();
INVIEWPORTULX = ulx; /* set values */
INVIEWPORTULY = uly;
INVIEWPORTLRX = lrx;
INVIEWPORTLRY = lry;
enable();
}
void TGE_getOutputViewport(int far *ulx, int far *uly, int far *lrx, int far *lry)
{
disable();
*ulx = OUTVIEWPORTULX; /* get values */
*uly = OUTVIEWPORTULY;
*lrx = OUTVIEWPORTLRX;
*lry = OUTVIEWPORTLRY;
enable();
}
void TGE_getInputViewport(int far *ulx, int far *uly, int far *lrx, int far *lry)
{
disable();
*ulx = INVIEWPORTULX; /* get values */
*uly = INVIEWPORTULY;
*lrx = INVIEWPORTLRX;
*lry = INVIEWPORTLRY;
enable();
}
/*****
****** Calculate the address of a pixel in a virtual screen.
*****/
unsigned char far* near outPixelAddr(int x, int y)
{
unsigned char huge *p;
unsigned long offset;
(void far*) p = OUTADDR; /* calculate pixel address */
offset = y;
offset *= OUTSCREENWIDE;
offset += x;
while (offset > 0xFFFF) /* add 'offset' to address */
{
p += 0xFFFF;
offset -= 0xFFFF;
}
p += (unsigned)offset;
return ((unsigned char far*) p); /* return the address */
}
unsigned char far* near inPixelAddr(int x, int y)
{
unsigned char huge *p;
unsigned long offset;
(void far*) p = INADDR; /* calculate pixel address */
offset = y;
offset *= INSCREENWIDE;
offset += x;
while (offset > 0xFFFF) /* add 'offset' to address */
{
p += 0xFFFF;
offset -= 0xFFFF;
}
p += (unsigned)offset;
return ((unsigned char far*) p); /* return the address */
}
/*****
****** Virtual/real screen switching
*****/
void far TGE_setGraphicsAddr(void far *addr)
{
TGE_setGraphicsInputAddr(addr); /* configure input */
TGE_setGraphicsOutputAddr(addr); /* configure output */
}
void far TGE_setGraphicsInputAddr(void far *addr)
{
register unsigned wide, deep;
if (addr != NULL) /* make a virtual screen active */
{
wide = ((unsigned*)addr)[0]; /* get memory block dimensions */
deep = ((unsigned*)addr)[1];
INADDR = (char*) addr + 4; /* store as active address */
INSCREENWIDE = wide; /* needed for virtual screens */
INMAXX = wide - 1; /* adjust current input */
INMAXY = deep - 1; /* screen dimensions */
TGE_setInputViewport(0, 0, wide-1, deep-1); /* viewport */
setInputFunctions(MEMORY); /* update TGE's function pointers */
}
else /* make the screen active */
{
INADDR = TGEsys->scrAddr; /* revert to screen address */
INSCREENWIDE = wide; /* needed for virtual screens */
INMAXX = SCREENMAXX; /* restore screen dimensions */
INMAXY = SCREENMAXY;
TGE_setInputViewport(0, 0, INMAXX, INMAXY); /* viewport */
setInputFunctions(SCREEN); /* update TGE's function pointers */
}
}
void far TGE_setGraphicsOutputAddr(void far *addr)
{
register unsigned wide, deep;
if (addr != NULL) /* make a virtual screen active */
{
wide = ((unsigned*)addr)[0]; /* get memory block dimensions */
deep = ((unsigned*)addr)[1];
OUTADDR = (char*) addr + 4; /* store as active address */
OUTSCREENWIDE = wide; /* needed for virtual screens */
OUTMAXX = wide - 1; /* adjust current screen */
OUTMAXY = deep - 1; /* dimensions */
TGE_setOutputViewport(0, 0, wide-1, deep-1); /* viewport */
setOutputFunctions(MEMORY, curOutputMode); /* update TGE's function pointers */
curOutputDest = MEMORY; /* store current destination */
}
else /* make the screen active */
{
OUTADDR = TGEsys->scrAddr; /* revert to screen address */
OUTSCREENWIDE = wide; /* needed for virtual screens */
OUTMAXX = SCREENMAXX; /* restore screen dimensions */
OUTMAXY = SCREENMAXY;
TGE_setOutputViewport(0, 0, OUTMAXX, OUTMAXY); /* viewport */
setOutputFunctions(SCREEN, curOutputMode); /* update TGE's function pointers */
curOutputDest = SCREEN; /* store current destination */
}
}
void far *TGE_getGraphicsOutputAddr(void)
{
if (OUTADDR == SCRADDR)
return (NULL);
else
return (OUTADDR);
}
void far *TGE_getGraphicsInputAddr(void)
{
if (INADDR == SCRADDR)
return (NULL);
else
return (INADDR);
}
void far *TGE_makeVirtScreen(unsigned wide, unsigned deep)
{
void far *addr;
if (wide && deep) /* ensure wide>0 and deep>0 */
{
addr = farmalloc(TGEsys->_imageSizeDim(wide,deep)); /* allocate some RAM */
if (addr == NULL)
return (NULL);
else
{
((unsigned*)addr)[0] = wide; /* store image width */
((unsigned*)addr)[1] = deep; /* store image depth */
return (addr); /* return the address */
}
}
else
return (NULL);
}
/*****
****** Change the current output mode
*****/
void TGE_setOutputMode(int mode)
{
curOutputMode = mode; /* store as current mode */
setOutputFunctions(curOutputDest, mode); /* setup for the new mode */
}
/*****
****** Update function pointers given output mode and destination.
*****/
void near setInputFunctions(int memOrScreen)
{
if (memOrScreen == MEMORY) /* set virtual screen active */
{
TGEsys->_getImage = TGEsys->_getImage_mem; /* getImage */
TGEsys->_getLine = TGEsys->_getLine_mem; /* getLine */
TGEsys->_getPixel = TGEsys->_getPixel_mem; /* getPixel */
}
else /* set real screen active */
{
TGEsys->_getImage = TGEsys->_getImage_scr; /* getImage */
TGEsys->_getLine = TGEsys->_getLine_scr; /* getLine */
TGEsys->_getPixel = TGEsys->_getPixel_scr; /* getPixel */
}
}
void near setOutputFunctions(int memOrScreen, int writeMode)
{
if (memOrScreen == MEMORY) /* set virtual screen active */
{
switch (writeMode)
{
case TGE_COPY_PUT: /* output using COPY */
TGEsys->_putImage = TGEsys->_putImage_mem_copy; /* putImage */
TGEsys->_putImageInv = TGEsys->_putImageInv_mem_copy; /* putImageInv */
TGEsys->_putLine = TGEsys->_putLine_mem_copy; /* putLine */
TGEsys->_putLineInv = TGEsys->_putLineInv_mem_copy; /* putLineInv */
TGEsys->_putPixel = TGEsys->_putPixel_mem_copy; /* putPixel */
TGEsys->_line = TGEsys->_line_mem_copy; /* line */
TGEsys->_horizLine = TGEsys->_horizLine_mem_copy; /* horizLine */
TGEsys->_vertLine = TGEsys->_vertLine_mem_copy; /* vertLine */
TGEsys->_drawRect = TGEsys->_drawRect_mem_copy; /* drawRect */
TGEsys->_filledRect = TGEsys->_filledRect_mem_copy; /* filledRect */
TGEsys->_clearGraphics = TGEsys->_clearGraphics_mem_copy; /* clearGraphics */
TGEsys->_ellipse = TGEsys->_ellipse_mem_copy; /* ellipse */
TGEsys->_filledEllipse = TGEsys->_filledEllipse_mem_copy; /* filledEllipse */
TGEsys->_circle = TGEsys->_circle_mem_copy; /* circle */
TGEsys->_filledCircle = TGEsys->_filledCircle_mem_copy; /* filledCircle */
TGEsys->_fillRegion = TGEsys->_fillRegion_mem_copy; /* fillRegion */
TGEsys->_fillLine = TGEsys->_fillLine_mem_copy; /* fillLine */
break;
case TGE_AND_PUT: /* output using AND */
TGEsys->_putImage = TGEsys->_putImage_mem_and; /* putImage */
TGEsys->_putImageInv = TGEsys->_putImageInv_mem_and; /* putImageInv */
TGEsys->_putLine = TGEsys->_putLine_mem_and; /* putLine */
TGEsys->_putLineInv = TGEsys->_putLineInv_mem_and; /* putLineInv */
TGEsys->_putPixel = TGEsys->_putPixel_mem_and; /* putPixel */
TGEsys->_line = TGEsys->_line_mem_and; /* line */
TGEsys->_horizLine = TGEsys->_horizLine_mem_and; /* horizLine */
TGEsys->_vertLine = TGEsys->_vertLine_mem_and; /* vertLine */
TGEsys->_drawRect = TGEsys->_drawRect_mem_and; /* drawRect */
TGEsys->_filledRect = TGEsys->_filledRect_mem_and; /* filledRect */
TGEsys->_clearGraphics = TGEsys->_clearGraphics_mem_and; /* clearGraphics */
TGEsys->_ellipse = TGEsys->_ellipse_mem_and; /* ellipse */
TGEsys->_filledEllipse = TGEsys->_filledEllipse_mem_and; /* filledEllipse */
TGEsys->_circle = TGEsys->_circle_mem_and; /* circle */
TGEsys->_filledCircle = TGEsys->_filledCircle_mem_and; /* filledCircle */
TGEsys->_fillRegion = TGEsys->_fillRegion_mem_and; /* fillRegion */
TGEsys->_fillLine = TGEsys->_fillLine_mem_and; /* fillLine */
break;
case TGE_NOT_PUT: /* output using NOT */
TGEsys->_putImage = TGEsys->_putImage_mem_not; /* putImage */
TGEsys->_putImageInv = TGEsys->_putImageInv_mem_not; /* putImageInv */
TGEsys->_putLine = TGEsys->_putLine_mem_not; /* putLine */
TGEsys->_putLineInv = TGEsys->_putLineInv_mem_not; /* putLineInv */
TGEsys->_putPixel = TGEsys->_putPixel_mem_not; /* putPixel */
TGEsys->_line = TGEsys->_line_mem_not; /* line */
TGEsys->_horizLine = TGEsys->_horizLine_mem_not; /* horizLine */
TGEsys->_vertLine = TGEsys->_vertLine_mem_not; /* vertLine */
TGEsys->_drawRect = TGEsys->_drawRect_mem_not; /* drawRect */
TGEsys->_filledRect = TGEsys->_filledRect_mem_not; /* filledRect */
TGEsys->_clearGraphics = TGEsys->_clearGraphics_mem_not; /* clearGraphics */
TGEsys->_ellipse = TGEsys->_ellipse_mem_not; /* ellipse */
TGEsys->_filledEllipse = TGEsys->_filledEllipse_mem_not; /* filledEllipse */
TGEsys->_circle = TGEsys->_circle_mem_not; /* circle */
TGEsys->_filledCircle = TGEsys->_filledCircle_mem_not; /* filledCircle */
TGEsys->_fillRegion = TGEsys->_fillRegion_mem_not; /* fillRegion */
TGEsys->_fillLine = TGEsys->_fillLine_mem_not; /* fillLine */
break;
case TGE_OR_PUT: /* output using OR */
TGEsys->_putImage = TGEsys->_putImage_mem_or; /* putImage */
TGEsys->_putImageInv = TGEsys->_putImageInv_mem_or; /* putImageInv */
TGEsys->_putLine = TGEsys->_putLine_mem_or; /* putLine */
TGEsys->_putLineInv = TGEsys->_putLineInv_mem_or; /* putLineInv */
TGEsys->_putPixel = TGEsys->_putPixel_mem_or; /* putPixel */
TGEsys->_line = TGEsys->_line_mem_or; /* line */
TGEsys->_horizLine = TGEsys->_horizLine_mem_or; /* horizLine */
TGEsys->_vertLine = TGEsys->_vertLine_mem_or; /* vertLine */
TGEsys->_drawRect = TGEsys->_drawRect_mem_or; /* drawRect */
TGEsys->_filledRect = TGEsys->_filledRect_mem_or; /* filledRect */
TGEsys->_clearGraphics = TGEsys->_clearGraphics_mem_or; /* clearGraphics */
TGEsys->_ellipse = TGEsys->_ellipse_mem_or; /* ellipse */
TGEsys->_filledEllipse = TGEsys->_filledEllipse_mem_or; /* filledEllipse */
TGEsys->_circle = TGEsys->_circle_mem_or; /* circle */
TGEsys->_filledCircle = TGEsys->_filledCircle_mem_or; /* filledCircle */
TGEsys->_fillRegion = TGEsys->_fillRegion_mem_or; /* fillRegion */
TGEsys->_fillLine = TGEsys->_fillLine_mem_or; /* fillLine */
break;
case TGE_XOR_PUT: /* output using XOR */
TGEsys->_putImage = TGEsys->_putImage_mem_xor; /* putImage */
TGEsys->_putImageInv = TGEsys->_putImageInv_mem_xor; /* putImageInv */
TGEsys->_putLine = TGEsys->_putLine_mem_xor; /* putLine */
TGEsys->_putLineInv = TGEsys->_putLineInv_mem_xor; /* putLineInv */
TGEsys->_putPixel = TGEsys->_putPixel_mem_xor; /* putPixel */
TGEsys->_line = TGEsys->_line_mem_xor; /* line */
TGEsys->_horizLine = TGEsys->_horizLine_mem_xor; /* horizLine */
TGEsys->_vertLine = TGEsys->_vertLine_mem_xor; /* vertLine */
TGEsys->_drawRect = TGEsys->_drawRect_mem_xor; /* drawRect */
TGEsys->_filledRect = TGEsys->_filledRect_mem_xor; /* filledRect */
TGEsys->_clearGraphics = TGEsys->_clearGraphics_mem_xor; /* clearGraphics */
TGEsys->_ellipse = TGEsys->_ellipse_mem_xor; /* ellipse */
TGEsys->_filledEllipse = TGEsys->_filledEllipse_mem_xor; /* filledEllipse */
TGEsys->_circle = TGEsys->_circle_mem_xor; /* circle */
TGEsys->_filledCircle = TGEsys->_filledCircle_mem_xor; /* filledCircle */
TGEsys->_fillRegion = TGEsys->_fillRegion_mem_xor; /* fillRegion */
TGEsys->_fillLine = TGEsys->_fillLine_mem_xor; /* fillLine */
break;
default:
;
}
}
else /* set real screen active */
{
switch (writeMode)
{
case TGE_COPY_PUT: /* output using COPY */
TGEsys->_putImage = TGEsys->_putImage_scr_copy; /* putImage */
TGEsys->_putImageInv = TGEsys->_putImageInv_scr_copy; /* putImageInv */
TGEsys->_putLine = TGEsys->_putLine_scr_copy; /* putLine */
TGEsys->_putLineInv = TGEsys->_putLineInv_scr_copy; /* putLineInv */
TGEsys->_putPixel = TGEsys->_putPixel_scr_copy; /* putPixel */
TGEsys->_line = TGEsys->_line_scr_copy; /* line */
TGEsys->_horizLine = TGEsys->_horizLine_scr_copy; /* horizLine */
TGEsys->_vertLine = TGEsys->_vertLine_scr_copy; /* vertLine */
TGEsys->_drawRect = TGEsys->_drawRect_scr_copy; /* drawRect */
TGEsys->_filledRect = TGEsys->_filledRect_scr_copy; /* filledRect */
TGEsys->_clearGraphics = TGEsys->_clearGraphics_scr_copy; /* clearGraphics */
TGEsys->_ellipse = TGEsys->_ellipse_scr_copy; /* ellipse */
TGEsys->_filledEllipse = TGEsys->_filledEllipse_scr_copy; /* filledEllipse */
TGEsys->_circle = TGEsys->_circle_scr_copy; /* circle */
TGEsys->_filledCircle = TGEsys->_filledCircle_scr_copy; /* filledCircle */
TGEsys->_fillRegion = TGEsys->_fillRegion_scr_copy; /* fillRegion */
TGEsys->_fillLine = TGEsys->_fillLine_scr_copy; /* fillLine */
break;
case TGE_AND_PUT: /* output using AND */
TGEsys->_putImage = TGEsys->_putImage_scr_and; /* putImage */
TGEsys->_putImageInv = TGEsys->_putImageInv_scr_and; /* putImageInv */
TGEsys->_putLine = TGEsys->_putLine_scr_and; /* putLine */
TGEsys->_putLineInv = TGEsys->_putLineInv_scr_and; /* putLineInv */
TGEsys->_putPixel = TGEsys->_putPixel_scr_and; /* putPixel */
TGEsys->_line = TGEsys->_line_scr_and; /* line */
TGEsys->_horizLine = TGEsys->_horizLine_scr_and; /* horizLine */
TGEsys->_vertLine = TGEsys->_vertLine_scr_and; /* vertLine */
TGEsys->_drawRect = TGEsys->_drawRect_scr_and; /* drawRect */
TGEsys->_filledRect = TGEsys->_filledRect_scr_and; /* filledRect */
TGEsys->_clearGraphics = TGEsys->_clearGraphics_scr_and; /* clearGraphics */
TGEsys->_ellipse = TGEsys->_ellipse_scr_and; /* ellipse */
TGEsys->_filledEllipse = TGEsys->_filledEllipse_scr_and; /* filledEllipse */
TGEsys->_circle = TGEsys->_circle_scr_and; /* circle */
TGEsys->_filledCircle = TGEsys->_filledCircle_scr_and; /* filledCircle */
TGEsys->_fillRegion = TGEsys->_fillRegion_scr_and; /* fillRegion */
TGEsys->_fillLine = TGEsys->_fillLine_scr_and; /* fillLine */
break;
case TGE_NOT_PUT: /* output using NOT */
TGEsys->_putImage = TGEsys->_putImage_scr_not; /* putImage */
TGEsys->_putImageInv = TGEsys->_putImageInv_scr_not; /* putImageInv */
TGEsys->_putLine = TGEsys->_putLine_scr_not; /* putLine */
TGEsys->_putLineInv = TGEsys->_putLineInv_scr_not; /* putLineInv */
TGEsys->_putPixel = TGEsys->_putPixel_scr_not; /* putPixel */
TGEsys->_line = TGEsys->_line_scr_not; /* line */
TGEsys->_horizLine = TGEsys->_horizLine_scr_not; /* horizLine */
TGEsys->_vertLine = TGEsys->_vertLine_scr_not; /* vertLine */
TGEsys->_drawRect = TGEsys->_drawRect_scr_not; /* drawRect */
TGEsys->_filledRect = TGEsys->_filledRect_scr_not; /* filledRect */
TGEsys->_clearGraphics = TGEsys->_clearGraphics_scr_not; /* clearGraphics */
TGEsys->_ellipse = TGEsys->_ellipse_scr_not; /* ellipse */
TGEsys->_filledEllipse = TGEsys->_filledEllipse_scr_not; /* TGEsys->_filledEllipse */
TGEsys->_circle = TGEsys->_circle_scr_not; /* circle */
TGEsys->_filledCircle = TGEsys->_filledCircle_scr_not; /* filledCircle */
TGEsys->_fillRegion = TGEsys->_fillRegion_scr_not; /* fillRegion */
TGEsys->_fillLine = TGEsys->_fillLine_scr_not; /* fillLine */
break;
case TGE_OR_PUT: /* output using OR */
TGEsys->_putImage = TGEsys->_putImage_scr_or; /* putImage */
TGEsys->_putImageInv = TGEsys->_putImageInv_scr_or; /* putImageInv */
TGEsys->_putLine = TGEsys->_putLine_scr_or; /* putLine */
TGEsys->_putLineInv = TGEsys->_putLineInv_scr_or; /* putLineInv */
TGEsys->_putPixel = TGEsys->_putPixel_scr_or; /* putPixel */
TGEsys->_line = TGEsys->_line_scr_or; /* line */
TGEsys->_horizLine = TGEsys->_horizLine_scr_or; /* horizLine */
TGEsys->_vertLine = TGEsys->_vertLine_scr_or; /* vertLine */
TGEsys->_drawRect = TGEsys->_drawRect_scr_or; /* drawRect */
TGEsys->_filledRect = TGEsys->_filledRect_scr_or; /* filledRect */
TGEsys->_clearGraphics = TGEsys->_clearGraphics_scr_or; /* clearGraphics */
TGEsys->_ellipse = TGEsys->_ellipse_scr_or; /* ellipse */
TGEsys->_filledEllipse = TGEsys->_filledEllipse_scr_or; /* filledEllipse */
TGEsys->_circle = TGEsys->_circle_scr_or; /* circle */
TGEsys->_filledCircle = TGEsys->_filledCircle_scr_or; /* filledCircle */
TGEsys->_fillRegion = TGEsys->_fillRegion_scr_or; /* fillRegion */
TGEsys->_fillLine = TGEsys->_fillLine_scr_or; /* fillLine */
break;
case TGE_XOR_PUT: /* output using XOR */
TGEsys->_putImage = TGEsys->_putImage_scr_xor; /* putImage */
TGEsys->_putImageInv = TGEsys->_putImageInv_scr_xor; /* putImageInv */
TGEsys->_putLine = TGEsys->_putLine_scr_xor; /* putLine */
TGEsys->_putLineInv = TGEsys->_putLineInv_scr_xor; /* putLineInv */
TGEsys->_putPixel = TGEsys->_putPixel_scr_xor; /* putPixel */
TGEsys->_line = TGEsys->_line_scr_xor; /* line */
TGEsys->_horizLine = TGEsys->_horizLine_scr_xor; /* horizLine */
TGEsys->_vertLine = TGEsys->_vertLine_scr_xor; /* vertLine */
TGEsys->_drawRect = TGEsys->_drawRect_scr_xor; /* drawRect */
TGEsys->_filledRect = TGEsys->_filledRect_scr_xor; /* filledRect */
TGEsys->_clearGraphics = TGEsys->_clearGraphics_scr_xor; /* clearGraphics */
TGEsys->_ellipse = TGEsys->_ellipse_scr_xor; /* ellipse */
TGEsys->_filledEllipse = TGEsys->_filledEllipse_scr_xor; /* filledEllipse */
TGEsys->_circle = TGEsys->_circle_scr_xor; /* circle */
TGEsys->_filledCircle = TGEsys->_filledCircle_scr_xor; /* filledCircle */
TGEsys->_fillRegion = TGEsys->_fillRegion_scr_xor; /* fillRegion */
TGEsys->_fillLine = TGEsys->_fillLine_scr_xor; /* fillLine */
break;
default:
;
}
}
}